Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
divyanshi
Contributor III
Contributor III

how to get number of days from the difference of two dates in qliksense??

I want to calculate number of days from the difference of two dates i.e 23-08-2017 and 24-02-2017   in Load Editor of qilksense.

Kindly help.

6 Replies
pathiqvd
Creator III
Creator III

Hi,

Try like this,

interval(date1-date2,'D')  as Days

Regards,

divyanshi
Contributor III
Contributor III
Author

but its giving 180 days but it should be 181 days.

pathiqvd
Creator III
Creator III

add +1

interval(date1-date2+1,'D')

divyanshi
Contributor III
Contributor III
Author

Still not getting right answer because 23-08-2017 minus 23-08-2017 has to be 0 but +1 makes it 1 which is not correct.

Kindly give the alternate option.

pathiqvd
Creator III
Creator III

check this,

   if(date1=date2,interval(date1-date2,'D'),interval(date1-date2+1,'D'))

jonathandienst
Partner - Champion III
Partner - Champion III

Do you want the interval to be inclusive (23-08-2017 and 24-02-2017 = 181), or exclusive ( 23-08-2017 minus 23-08-2017 has to be 0)

Inclusive 181 and 1

Exclusive 180 and 0

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein