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 as variable in a set analysis

Hello.

I'd like to compare the sales between a certain date (YYYY-MM) and the same period but a year before.

This certain date is a manually typed variable named MonthA.

I've been able to graph the sales of that exact month with the following expression, even thought it says 'Error in expression':

sum({$<time.MonthYear={'$(=date(date#(MonthA,'YYYY-MM'),'YYYY-MM'))'}>} Sales).

I've tried using two manually typed variables, MonthA and MonthB and it works but I'd like to accomplish the same with an expression.

sum({$<time.MonthYear={'$(MonthA)','$(MonthB)'}>} Sales)

I've tried using addyears(date(date#(MonthA,'YYYY-MM'),'YYYY-MM')),-1) but it doesn't work. Could you help me out?

Thanks a lot.

1 Reply
Anonymous
Not applicable
Author

I've solved it after going to Settings >> Variable Overview and setting MonthB as =NUM(LEFT('$(MonthA)',4)-1)&'-'&RIGHT('$(MonthA)',2).