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

How to use alternate states with set analysis - qlik sense syntax

Hi,

I am trying to write a KPI measure in Qlik sense using both alternate states and set analysis.

My measure is:

COUNT(DISTINCT {$<CONSENSE = {'OK'},CCONTRACT = {'$(v_Contract)'}>} COD)

how can I insert the alternate state "Group 1" in the measure? Nothing seams to work with set analysis.

 

Thanks in advance,

G.

5 Replies
hic
Former Employee
Former Employee

If you want the selection CONSENSE = {'OK'},CCONTRACT = {'$(v_Contract)'} applied on [Group 1] you should use

COUNT(DISTINCT {[Group 1]<CONSENSE = {'OK'},CCONTRACT = {'$(v_Contract)'}>} COD)

Also, check which state the object itself belongs to (under the object properties).

gio92
Contributor II
Contributor II
Author

I tried but it not working, it's giving me 0 all the time.

COUNT(DISTINCT {[Group 1]<CONSENSE = {'OK'},CCONTRACT = {'$(v_Contract)'}>} COD)

hic
Former Employee
Former Employee

It should also work if you make sure that the object belongs to the [Group 1] state (which you set under Object properties --> Appearance --> Alternate states) and omit the set identifier from the expression:

COUNT(DISTINCT {<CONSENSE = {'OK'},CCONTRACT = {'$(v_Contract)'}>} COD)

gio92
Contributor II
Contributor II
Author

I checked and the alternate set is perfectly set, but still not working.

hic
Former Employee
Former Employee

Then you must have some other error. Check spelling (Is the field name really "CCONTRACT"?), check that the variable has a value, etc.