Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
asinghal0412
Partner - Creator
Partner - Creator

Create a measure to find the difference between 2 calender dates

Dear Qlik community,

I have a silly or basic question!

I have 2 calender dates D1 and D2. 

I have to find the difference between these 2 dates in terms of days. For example:

if D1 = 15 Mar 2021 and D2 = 21 Mar 2021

then D2 - D1 should give = 6 days

Can anyone help me?

 

Best,
A.S

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Dates are represented internally in Qlik as  number of days since 30 Dec 1899.  So to find the duration in days between two dates, subtract.

EndDate - StartDate

Just like you said: D2 - D1 🙂

-Rob

View solution in original post

4 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Dates are represented internally in Qlik as  number of days since 30 Dec 1899.  So to find the duration in days between two dates, subtract.

EndDate - StartDate

Just like you said: D2 - D1 🙂

-Rob

JordyWegman
Partner - Master
Partner - Master

Hi Asinghal,

Just like @rwunderlich  said, you can just subtract them. But where do you want to do this? In the script or in the front end? And for what are you using it?

 

Jordy 

Climber

Work smarter, not harder
asinghal0412
Partner - Creator
Partner - Creator
Author

Thanks Rwunderlich! Actually I entered the date in the wrong format. Now it works!

asinghal0412
Partner - Creator
Partner - Creator
Author

I wanted to do it in the front end but it works now. My fault was the wrong date format in the script. Got it right now! Thanks