2 Replies Latest reply: Apr 12, 2017 11:06 AM by clark meyers

# Case When in UI

hello,

i need to implement a custom measure in the UI of qlik sense.

the main logic is like the following

sum(

case when type in ('a','b','c') and state in ('0','1') and flag=('yes') then measure1

case when type in ('a') and state in ('1') and flag=('yes') then measure1

case when type in ('b') and state in ('0',) and flag=('no') then measure1

else 0

end

)

how can this be handled with set-analysis in the UI ?

can you give me an example for that?

• ###### Re: Case When in UI

Hi Clark,

if I understand correctly, you have 3 case conditions that could all be put together with the OR operator. If either one of these three conditions is true, you'd like to summarize Measure1, otherwise you'd like to zero-out the value.

You can build this condition in Set Analysis by using 3 separate Modifiers, united by the Boolean operator "+" (Union). Something like this:

sum(

{

<type = {'a','b','c'} , state = {'0','1'} , flag={'yes'}> +

<type = {'a'} , state = {'1'} , flag={'yes'} > +

<type = {'b'} , state = {'0'} , flag={'no'}>

}  Measure 1)

You can learn advanced Set Analysis and Advanced Aggregation (AGGR) from my lecture at the Masters Summit for Qlik - coming this fall to Boston, MA. I also explain advanced Set Analysis techniques in my book QlikView Your Business: An Expert Guide to Business Discovery with QlikView and Qlik Sense.

cheers,

Oleg Troyansky

• ###### Re: Case When in UI

Hello Oleg,

Thx for your input - my measure is now working!