Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
rtr13
Contributor III
Contributor III

Variable in intersection

Hi Everyone -

I currently have an inline table that pulls in values that I want to use within my set analysis to help limit the amount of expressions I need to write. Below is the current expression I am trying to use: 

=Num(Count({<primaryprocedure={'*$(vSTSMultiple)*'}>} distinct logid),'##,###') 

Within the vSTSMultiple variable, I am referencing a column in my inline table that includes values such as, VSD, Switch, Glenn, etc. The primary goal would be for the variable within my set analysis to be replaced with the value a customer selected within a list box. The list box is set to only one selected so users can't select multiple values. 

The field that drives the list box is the same one that drives the variable found within my set analysis. Is there a way to include a variable between the ** in my set analysis? 

3 Replies
stevejoyce
Specialist II
Specialist II

Define your vSTSMultiple globally like =Only(primaryprocedure_ISLANDTABLE)

then this expression should work:

Num(Count({<primaryprocedure={$(vSTSMultiple )}>} distinct logid),'##,###') 

rtr13
Contributor III
Contributor III
Author

When defining the vSTSMultiple variable globally, in the only() would I reference the inline table I created? Then when it comes to the expression, the large issue I'm running into is when trying to use intersection within the set analysis while using a variable, so the expression provided didn't get me to exactly where I needed to be. 

Thanks!

stevejoyce
Specialist II
Specialist II

Yes, it would reference your inline table's field.  Not sure what exactly is off.  There are options, but maybe if you can provide more details i can help.

your set analysis would have [field associated to data model]={$(vVariable)} or '$(vVariable)' where vVariable is =only([island table name]).

 

If you need more complex intersection.  It could be done with *=, or using P() function maybe, or <set1> * <set2>, not sure which approach is needed for your issue.