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

Set analysis with dynamic variable

Hi, I've been trying to get a set analysis expression working with a variable without any luck.  My variable value is set dynamically depending on selection(s) of a dimension.  Definition is as follows:

If(GetSelectedCount(Test_ID)<> 1,('SYP' &  ',' & 'RPR'),

      If(MixMatch(GetFieldSelections(Test_ID),'SYP'),('SYP'),

      If(MixMatch(GetFieldSelections(Test_ID),'RPR'),('RPR'),('SYP' &  ',' & 'RPR'))))

When I put this value in a KPI it displays as SYP,RPR but if I use it in a set analysis expression like the following it doesn't apply and shows up as a - in the kpi

=Count({$<Positive = {'Y'},Test_ID={$(=vSYPRPR)}>}[Order#])

If I define the variable like the following then the correct values are returned

='SYP,RPR'

Is it not possible to use a dynamically defined variable in set analysis?  I've looked up lots of examples of using variables in set analysis and tried the various examples I've seen on the community but have not been able to get this to work.

Thanks in advance for any help or insight.

11 Replies
wayne-a
Creator
Creator
Author

Ugh, so somewhere in my cutting and pasting I left an "=" sign in the NUM function.  I tried it again with some of my other variables but they still didn't work, so I did need the Chr(39) version which was the real issue.

Thanks again for all your help.

sunny_talwar

Also, added = before the variable vSYPCH39. Removed $() from the KPI variable and removed - sign after Num(...)