Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get the days difference

Hi All,

Is there any function in QV like SQL function:datediff(day, startdate , enddate) ?

Thanks.

4 Replies
tresesco
MVP
MVP

Interval() ?

Like: Interval(startdate-enddate, 'DD')    // or changing the order of dates

Sokkorn
Master
Master

Hi Isaac,

Try to use Interval(EndDate-StartDate,'D') or simply use EndDate-StartDate to get day different.

Regards,

Sokkorn

Not applicable
Author

You can also sort it asc in a straight table and do an Above expression.

Example:

(Date)-(Above(Date))

Thanks

Stefan

techvarun
Specialist II
Specialist II

1. date((date(Field1,'MM/DD/YYY')-date(Field2,'MM/DD/YYYY')),'DD')

2. Interval(Field1-Field2,'dd')

3.date(timestamp#(Field1,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY') as Date2,

  date(timestamp#(Field1,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY') as Date1,


Interval( (date(timestamp#(date2,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY')) -  (date(timestamp# (date1,'MM/DD/YYYY hh:mm:ss'),'DD/MM/YYYY')), 'd') as DTDiff

Use this thread

regards