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: 
Not applicable

Set analysis question

I have created a profit / loss statement. I am trying to compare same period last year.

To make this work, I use this expression:

Sum({1<Year={'=$(vLastYear)'},Period={'=$(vPeriod)'}>}Value)

vLastYear and vPeriod gets the value based on selection made by the user. If user sets year = 2014 the value is 2013. To accomplish this I use the expression =(GetFieldSelections(Year)-1). The listbox is set to only one  possible value selected.

The problem that I am having is that regardless what year I select, it is showing the result for the selected year, not the previous year.

If I change the variable $(vLastYear) with the actual year (f.example 2013), the result is correct.

I have also tried to change the {1< in the set expression to {$<, but this seems not the change anything.

I have checked the value for vLastYear, and it is giving me the correct result (in other words if I choose 2014, the value is 2013).

Hope someone can help me in the right direction.

1 Reply
Not applicable
Author

Found the answer myself

This worked:

Sum({$<Year={$(#vLastYear)}>}Value)

Hope someone also can use this sollution.