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

Sales from previous year

Hi,

I'm trying to display number on chart. Those number are monthly sales from the current year compare with the last year.

To display the current year; no problem ; --> Sum([Gross Order]

But to display the one from previous year, I don't get it;

I have try

WIth the year : Sum({<Year={$(=max(Year)-1)}>}[Gross Order])

or with the month : Sum({<Month={$(=max(Month)-12)}>}[Gross Order])

None of them works.

Can anyone help me?

P.S. : The dimension I have is DATE which is on the format dd/mm/yy .

Thanks in advance

6 Replies
sunny_talwar

MK9885
Master II
Master II

Maybe Use

if(InYear(TempDate, today(),-1), 1, 0) as LastYearFlag,

In your Master Calendar script and in front end

Sum({<LastYearFlag={1}>}[Gross Order])



I'm not sure if it will work or no...

Not applicable
Author

To get the Gross order Value of the Previous Year when you click on the current year

Use this expression:

Sum({$<Year={$(=max(Year)-1)}>}[Gross Order])

Not applicable
Author

Hi

Thanks for the help. Almost the same as what I try but unfortunately, it doesn't work...

It looks like it doesn't take into account the "(Year)-1".

vinieme12
Champion III
Champion III

try Sum({<Year={'$(=max(Year)-1)'}>}[Gross Order])

or create flags

Period Presets: Compare Periods on the fly

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
parimikittu
Creator II
Creator II

Sum({<Year={$(=max(Year)-1)}>}[Gross Order]). This will not wok unless u have selection on Date dimension. So

please use below

Sum({<Year={$(=max({1}Year)-1)}>}[Gross Order]). Let us know incase of any issues.