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

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?

thanks in advance!

1 Solution

Accepted Solutions
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

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

View solution in original post

2 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

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

Not applicable
Author

Hello Oleg,

Thx for your input - my measure is now working!