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

Perform calculation on variable in set analysis

I have created a variable CurrYear to denote the Current Year. I have used it in Set Analysis to sum data where Year=CurrYear.

I have even included it in the labels in my chart to e.g. 'Sales '&$(CurrYear)


I have also shown previous year in label using 'Sales '&(num($(CurrYear))-1)

Now I want to use Set Analysis to sum data for last year. I hoped to use some version of the formula above
(ie num($(CurrYear))-1), but it does not seem to work.

What is my problem?

1 Solution

Accepted Solutions
Not applicable

Try with

sum ({<Year={$(=num($(CurrYear)-1))>} Sales)

View solution in original post

3 Replies
Not applicable

Try with

sum ({<Year={$(=num($(CurrYear)-1))>} Sales)

Not applicable

OR create a new variable PrevYear=num($(CurrYear))-1)

and then

sum({<Year={$(PrevYear)}>} Sales)

mazacini
Creator III
Creator III
Author

Many thanks