Announcements
You can succeed best and quickest by helping others to succeed. Join the conversation.
cancel
Showing results for
Did you mean:
Not applicable

Count the days between two dates

Hello,

Can you tell me how can I count the days between two dates ?

I want to create a chart with opened cases and I have to create some dimensions in days.

<7 days 14-14 days 14-30 days 30-90 days.

Similar to this chart.

And I don't have any ideas how to do this. Can you give me a clue ?

Thanks!

1 Solution

Accepted Solutions
Master III

Use a calculated dimension with an if condition like below

if (Interval(DateField2 - DateField1,'D')<7,'<7 days',

if(Interval(DateField2 - DateField1,'D')>7 and Interval(DateField2 - DateField1,'D')<14,'7-14 days',

if(Interval(DateField2 - DateField1,'D')>14 and Interval(DateField2 - DateField1,'D')<30,'14-30 days',

if(Interval(DateField2 - DateField1,'D')>30 and Interval(DateField2 - DateField1,'D')<90,'30-90 days','>90 Days'))))

hth

Sasi

11 Replies
Not applicable
Author

Hi,

Can you share your qvw file or sample file.

Specialist III

=fabs(Date(EndDate,'DD/MM/YYYY')) - fabs(Date(StartDate,'DD/MM/YYYY'))

Not applicable
Author

Is not working.

Master III

Use a calculated dimension with an if condition like below

if (Interval(DateField2 - DateField1,'D')<7,'<7 days',

if(Interval(DateField2 - DateField1,'D')>7 and Interval(DateField2 - DateField1,'D')<14,'7-14 days',

if(Interval(DateField2 - DateField1,'D')>14 and Interval(DateField2 - DateField1,'D')<30,'14-30 days',

if(Interval(DateField2 - DateField1,'D')>30 and Interval(DateField2 - DateField1,'D')<90,'30-90 days','>90 Days'))))

hth

Sasi

Specialist III

can you share sample qvw file?

Not applicable
Author

Hi try this:

If date field don't have time stamp

Date(todate)-date(frondate) as date-count

If time stamp first u have to trim the time then use above statement

Specialist III

difference between two dates.