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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Lucent
Contributor II
Contributor II

Negative value from date difference in different month.

Hi together,

 

I have one question regarding date difference.

e.g.  i would like to know the date difference between 2024/07/01 and 2024/06/30.

my expectation is 1. but the result is -29, as if Qlik just calculates date difference ignoring given month.

Since i do not want to load script for this try, i just create the following chart function in front end.

Date#(Text('2024-07-01'),'yyyy-mm-dd') - Date#(Text('2024-06-30'),'yyyy-mm-dd')

Does anybody make the result of given formular 1 instead of -29?

 

Note:

if i change the year, the result will be changed.

e.g. 2025-07-01 minus 2024-07-01 is 366. but as soon as month is different, the result does not correpond to right value.

2025-07-01 minus 2024-06-30 should be 367. but result by Qlik is 337.

Thank you so much for your feedback:)

 

 

 

 

Labels (5)
1 Solution

Accepted Solutions
marcus_sommer

The format-pattern isn't correct. Try it with:

Date#('2024-07-01','YYYY-MM-DD') - Date#('2024-06-30','YYYY-MM-DD')

View solution in original post

3 Replies
marcus_sommer

The format-pattern isn't correct. Try it with:

Date#('2024-07-01','YYYY-MM-DD') - Date#('2024-06-30','YYYY-MM-DD')

BrandonFontes
Partner - Contributor III
Partner - Contributor III

@Lucent 

Try this:

=Date(Date#('2024-07-01','YYYY-MM-DD')) - Date(Date#('2024-06-30','YYYY-MM-DD'))

Project Leader and Qlik Specialist at Work Avanti Solutions | www.avantisolucoes.com.br
Lucent
Contributor II
Contributor II
Author

Thank you so much for both answer, both works properly. then i will post additional relevant problem in load script later:)