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

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

You may apply:

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

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

 

GrantSk
Contributor
Contributor
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) & '}', '')