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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Nighthawk
Contributor II
Contributor II

Filter variable in set analysis

If i have a variable called vFoo. Can we filter this variable directly in set analysis?

Something like:

Sum({$<$(vFoo) = {"<10"}>}Sales)

2 Replies
Vegar
MVP
MVP

No, but an variable has single value therefore you could use an if statement.

 

IF($(vFoo) = <10, Sum(Sales),0)
petter
Partner - Champion III
Partner - Champion III

You can do this - but it is important that the vFoo will evaluate to something that is relevant and contains a field:

 

Sum( { <UniqueRowId={"=($(vFoo))<10"}> } Sales)

 

So the expression =$(vFoo)<10 should evaluate to a boolean result that determines which rows that would be included in the sum. If vFoo evaluates to a constant then the sum would be zero or if not the sum of all rows.

 

The field on the left hand side does not necessarily need to be a UniqueRowId but I find it easier to understand it and get it to work by having that as the field. If you have a non-unique row id as field means that the expression on the right hand side MUST have aggregation functions just like you would use in a "group by" in a SQL statement or LOAD statement.