Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

divyanshi
New Contributor II

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
Contributor III

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

Hi,

Try like this,

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

Regards,

divyanshi
New Contributor II

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

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

pathiqvd
Contributor III

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

add +1

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

divyanshi
New Contributor II

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

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
Contributor III

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

check this,

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

MVP
MVP

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

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