Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date comparison

Hello !

I need to compare the max date of max year (Done), with the same day&month of year = 2011.

What i mean:

max date = 10/11/2014

sum(date={"<=$(=max(date))"}something) //Year of 2014

/

sum({<date={"<=$(=max(date))"}, year={2011}>}something)

This doesnt work.Because, the max date of second expression are different of month 11 and day 10.

I need to compare the historic in the same day. Sum of something in 10/11 in 2011 and 2014.

Somebody know how to do this?

Thanks!

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Ok, maybe this then:

sum({<date={"<=$(=makedate(2011,  month(max(date)), day(max(date)) ))"}>}something)


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

Try using the addyears function:

sum(date={"<=$(=max(date))"}something)

/

sum({<date={"<=$(=addyears(max(date),-3))"}>}something)


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thanks for the answer Gysbert!

I cant do this.

Because, my max year can be 2005, 2006, 2010, 2014, etc.

So i need to do this dynamic.

Is possible?

Thanks !

Gysbert_Wassenaar

Ok, maybe this then:

sum({<date={"<=$(=makedate(2011,  month(max(date)), day(max(date)) ))"}>}something)


talk is cheap, supply exceeds demand
MarcoWedel

Hi,

one solution could be:

Sum({$<date={'$(=Max(date))'}>} something)/Sum({$<date={'$(=SetDateYear(Max(date),2011))'}>} something)

QlikCommunity_Thread_141518_Pic1.JPG.jpg

QlikCommunity_Thread_141518_Pic2.JPG.jpg

QlikCommunity_Thread_141518_Pic3.JPG.jpg

hope this helps

regards

Marco