5 Replies Latest reply on Aug 17, 2013 7:14 AM by Shawn Wallwork

# Is there a way to count dates as a count?

Hi,

I would like to know if there is a way to count dates. Let's say if I have a set of dates between 6/1/2013 and 8/30/2013 can I count backwards as 90, 89, ......................5,4,3,2,1 days. 90 days being the count of days for three months.

Any expert suggestions would be welcomed.

Thank you

• ###### 1. Re: Is there a way to count dates as a count?

Kiran,

Try creating a calculated field with this code:

DATEDIFF('day', [Date], #8/30/2013#)

You'll probably want to drag the field you create from measures to dimensions.  You can also right click the field and change it to discrete if you want headers instead of an axis.

Regards,

Joshua

1 of 1 people found this helpful
• ###### 2. Re: Is there a way to count dates as a count?

Hi Joshua,

Your formula works wonders but what if I want to look at all these 30 days in between as a count leading upto that 1 day. for example I tried your formula and tweaked a little bit so it looks like this :-

DATEDIFF('day',#7/30/2013#,#8/30/2013# )

From this you will know that it gives me one single count of 30 days in the view but now I want to see those 30 days counting backwards 30,29.28.........1. Is there a way to do that. Am I missing something or does this question make sense?

Regards,

Kiran

• ###### 3. Re: Is there a way to count dates as a count?

Reason for me to have a count up to the last day possible i.e. 30,29,28,27........all the way to 1 is because my vizz will show a clear picture of the data that I want to present right to the day instead of 30 or 32 days out.

• ###### 4. Re: Is there a way to count dates as a count?

30-DATEDIFF('day',#7/30/2013#,#8/30/2013# )

--Shawn

• ###### 5. Re: Is there a way to count dates as a count?

This is what I was talking about, this small tweak of 30-datediff gives exactly what I want.

Thank you Shawn for your expertise.

Regards,

Kiran