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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
LoKi_asterix
Contributor III
Contributor III

If condition to set analysis expression

Hi All,
The expression as first expression/Column(1) which counts unique IDs as expected 

Sum(Aggr(If(Count(DISTINCT {$<Year={'$(vMaxYear)'}>} IDs) = 1, 1), IDs))

I have this expression in the next expression tab

IF(COLUMN(1) > 0 AND LEN(TEL) > 0, COUNT(DISTINCT TEL))

I’m looking to optimize this for better performance on the front end by incorporating Set Analysis where possible.

Any suggestions for improvement would be greatly appreciated. Thanks!

1 Reply
Daniel_Pilla
Employee
Employee

It looks like you already have the proper set analysis. Provided that the "IDs" field are unique IDs, the first expression can be replaced with:

 

Count({$<Year={'$(vMaxYear)'}>} DISTINCT IDs)

 

or

 

{$<Year={'$(vMaxYear)'}>} Count(DISTINCT IDs)

 

For the second, if I'm understanding this properly, if you were to ensure that the empty values of "TEL" are in fact null, you could use

Count({<IDs={"=Count({$<Year={'$(vMaxYear)'}>} DISTINCT IDs)>0"}>} DISTINCT TEL)