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: 
rido1421
Creator III
Creator III

Max Date and Max Day Variable

Hi There

I would like to create a variable  for max(Day) and Max(Year)

I have a dashboard and I have the current year sales figures

I also have last year sales figures I want to compare the two YTD so in my set analysis of the previous year I want to use a variable

to tell it to give me the sales figures for last year but only up until this years Max(Day)

what is the best way to do this?

I hope this makes sense...

Regards

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Create a variable vMaxDay as =max(Day) and a variable vMaxYear as =max(Year).

You can use these variables in set analysis expressions.

Current: sum(Amount)

Previous year: sum({<Year={$(=vMaxYear-1)},Day={'<=$(=vMaxDay-1)'}>} Amount)


talk is cheap, supply exceeds demand
rido1421
Creator III
Creator III
Author

I have used =(Day(today()-1)) as my variable vCurrentDay and then used this in my set analysis

seems to work well... do you see any Issues I may have from doing it this way Gysbert?