Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to find the date diff between two dates in Qlikview.

Hi All,

I have two date fields in qlikview and i want to show the diff between dates of the respective values. Is there any datediff() function or any other function to find the diff. of two dates.

Thanks,

Rahul

6 Replies
Not applicable
Author

Hi Rahul,

I assume this is a chart expression and not in the script.

Datediff is what you would use in SQL. With the SQL function you can specify whether you want Days/Months/Years/Hours.

In QV you could simply "Date1 - Date1" which will use the Julian date (39827 - 39934) and give you the number of days difference. To get years difference you have to you "year(Date1) - year(Date2)".

I hope this was helpful.

Regards,

Werner

Not applicable
Author

hi rahul

solution given to you bywrenback is right

Himanshu

Not applicable
Author

Thanks Maestro this works.... Smile

Not applicable
Author

Thanks for ur time.... Smile

Not applicable
Author

Hi, I'm trying to find a similar datedif function, I had got as far as using julian date diffs but its not effective,

i.e. if you take the last day of 2009, in Julian 109365 - the last day in 2008, 108365 then your answer would be 1000, and thats not the case, there aren't 1000 days between the last day of 08 and the last day of 09.

How can you do it? Even when I turn them into actual dates I can't take one from the other. Any ideas?

Not applicable
Author

Are you sure that your 'dates' are being recognised as dates? For example , this little test script returns a value of 365 for 'diff' wher emy date format is dd/mm/yyyy

[t1]:
LOAD * INLINE [
F1, F2
31/12/2009, 31/12/2008
];

load *, F1 - F2 as diff resident t1;

Regards,

Gordon