4 Replies Latest reply on Aug 28, 2018 6:10 PM by Shinichiro Murakami

# Date Calcs

I need to figure out how to calculate a couple of things and then combine them into one formula:

1. The current day. For example, today's the 28th, I want it to say 28.

2. The total # of days in the month. It's August, so I want it to say 31.

I tried starting the calc under the measure "Pace", using the Dimension "Current Day", using the Today() calc, but it tells me that I can't divide a float value by date value. Not sure how to fix that. My calc for total # of days in the month is way wrong too.

• ###### 1. Re: Date Calcs

Not eactly sure abotu other , but number of days in month is calclulated with this

Thanks,

Shin

1 of 1 people found this helpful
• ###### 2. Re: Date Calcs

That calc does give me the correct number of days in the month. I also tried this calc for the current day, just made a copy of current day, ATTR(DAY(TODAY())+1 )

It gives me the correct output. However, when I combine the calcs together, the amount isn't correct. It should be 48597.89 but I get 46922.10.

• ###### 3. Re: Date Calcs

I got it to work! I used your calc for the number of days in the month but slightly adjusted it to: datetrunc('month',dateadd('month',1,TODAY()))-datetrunc('month',TODAY())

Then I changed the current day calc to: ATTR(DAY(TODAY())).

The whole formula is SUM([1-90 Day Amount])/[Current Day]*[# of Days in Month] and I get the correct amount.

• ###### 4. Re: Date Calcs

Hi Barb,