Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I am new user of Qlik Sense and I'm trying to write a multiple if color expression for a measure calculated using set analysis but I can't write the expression does not seems to work if a try to insert more than one if statement at the time.
Measure variable: Count({$<[Tipo Conversione]={D}>}[ID Polizza]) / Count(distinct{$<flg_first_policy>}[ID Lead])
Color expression (wrong): if(Count({$<[Tipo Conversione]={D}>}[ID Polizza]) / Count(distinct{$<flg_first_policy>}[ID Lead])<0.04, rgb(51,51,255)),
if(Count({$<[Tipo Conversione]={D}>}[ID Polizza]) / Count(distinct{$<flg_first_policy>}[ID Lead])>=0.04,rgb(0,51,102),rgb(51,51,102))
Can someone give me any advice on how to do this??
Thanks
Firstly, is your variable getting value?
If I simplify your color expression, I get:
if(measure<0.04, rgb(51,51,255)),
if(measure>=0.04,rgb(0,51,102),rgb(51,51,102))
I am a little confused. Could you please clarify how you would like to define the colour?
hi
in the first part of your measure write {D} like {'D'}, because it is text!
in the second part of your expression <flg_first_policy> equals what? otherwise you need TOTAL before
if you want to fix it then write <flg_first_policy=>
couple of things
your syntax is wrong closing of brackets is not right
if(Count({$<[Tipo Conversione]={D}>}[ID Polizza]) / Count(distinct{$<flg_first_policy>}[ID Lead])<0.04, rgb(51,51,255), //deleted 1 bracket
if(Count({$<[Tipo Conversione]={D}>}[ID Polizza]) / Count(distinct{$<flg_first_policy>}[ID Lead])>=0.04,rgb(0,51,102),rgb(51,51,102)) ) // added one bracket
Second
the else condition in your second if will never be satisfied. first if is measure<0.04 so when you do second if measure>=0.04 it will always be true. so not sure if you defined these correctly