Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set analysis - pulling last years data with a variable

Hi

Just trying to get some data using set analysis but running into a problem

I have a few buttons at the top where i can set the year i'm interested in

and putting this expression in

=count({$<RegYear={$(v_year)}>} distinct person_id)

works fine regardless of the year I select. e.g. 2016, 2015, 2014 , all bring back data

when i add a 2nd expression which tries to pull the previous years data using the expression

=count({$<RegYear = {$(v_year - 1) }>} distinct person_id)

the output is just a row of 0's

Can anyone spot any issues with this 2nd formulas please

3 Replies
sushil353
Master II
Master II

Try this:

=count(distinct {$<RegYear = {'$(v_year)-1 '}>} person_id)

HTH

antoniotiman
Master III
Master III

Try

=count({$<RegYear = {$(=$(v_year) - 1) }>} distinct person_id)

Not applicable
Author

Thank you Antonio, works perfect