Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
h2k18
Contributor II
Contributor II

SET Analysis with variables

Hi,

I have created the following variable to be utilized in the set analysis calculation:

vCurrQTR = 2018Q4 (User selected)

Variable Name: vTestQTR

 =if(right(vCurrQTR,2) = 'Q4',
chr(39)&left(vCurrQTR,4)&''&'Q1'&chr(39)&chr(44)&
chr(39)&left(vCurrQTR,4)&''&'Q2'&chr(39)&chr(44)&
chr(39)&left(vCurrQTR,4)&''&'Q3'&chr(39)&chr(44)&
chr(39)&left(vCurrQTR,4)&''&'Q4')&chr(39)

If we evaluate the above variable (=vTestQTR) in Text & image object it will yield the following result: '2018Q1','2018Q2','2018Q3','2018Q4'

Currently:
sum({<PERIOD_TYPE = {'Q'},RETURN_TYPE = {'S'},PERIOD = {'2018Q1','2018Q2','2018Q3','2018Q4'}>}Return) gives the correct result.

Now using variable would like to replace the above highlighted condition and get the same result. Unfortunately the variable is not working as expected inside the set analysis expression. Can you help with the correct syntax?
sum({<PERIOD_TYPE = {'Q'},RETURN_TYPE = {'S'},PERIOD = {'variable'}>}Return)

Sample file attached.

Thanks.

Labels (2)
0 Replies