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

set issue

I have wrote the code of Previous Year in set it show previous year in set expression but data show of current year..

what will be the issue...

sum({<FYear=$(=Max(FYear-1)Amount)

5 Replies
sunny_talwar

I am amazed that it is showing you anything because syntax is not right. Try this:

=Sum({<FYear = {'$(=Max(FYear)-1)'}>} Amount)

QlikAngel
Partner - Creator
Partner - Creator
Author

Nopes.. i have wrote so here got syntax mistake.. but i took in variable also it shows me previous year.. but data & total is coming of current year..

just let me know one thing.. is selected Year field will be in Variable field

in selection box i have field name called FYear

in Expression i am comparing with FYear = {'$(=Max(FYear)-1)'}>}

so is that correct.. in variable i m creating like Max(FYear)-1

sunny_talwar

What is your chart dimension? Is it FYear by any chance?

QlikAngel
Partner - Creator
Partner - Creator
Author

i am selecting FYear on top .. my dimension is Customer Name

sunny_talwar

So yes, you can create a variable vPreviousYear = '=Max(FYear) - 1' (Everything within the single quotes need to be in your variable)

and then use it like this:

=Sum({<FYear = {'$(vPreviousYear)-1)'}>} Amount)