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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
GrantSk
Contributor II
Contributor II

Inject Variable into Set analyis

Hi all,

I'm trying to inject a variable into a Master Item depending on selections.

Ideally if no selection is made then the Master Item would be something like:

Sum({< Product = {'Shoes'} >} Sales) 

But should a certain selection is made then ideally the Master Item would look like:

Sum({< Product = {'Shoes'}   & '$(vVar)' >} Sales) 

The variable would look like :

vVar = ' ,Country = {'England'}'

This is wanted to avoid creating a number of master items which are identical except for one filter difference.  So when nothing is selection the vVar would be null.

 

Labels (3)
2 Replies
marcus_sommer
MVP
MVP

You may apply:

vVar:  = if(getselectedcount(YourField), ' ,Country = {'England'}', '');

Sum({< Product = {'Shoes'}   & $(vVar) >} Sales) 

 

GrantSk
Contributor II
Contributor II
Author

@marcus thanks for your reply.  This got me most of the way there . In the master item I had to remove the &  for it to work:

Sum({< Product = {'Shoes'}   $(vVar) >} Sales) 

The variable I had to add Chr(39) to get the ' to show:

vVar = If(getselectedcount(YourField),',Country = {' & chr(39) & 'England' & chr(39) & '}', '')