Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Sahal
Creator II
Creator II

IF() to Set Analysis?

Hi,

I would like to know how to turn an if statement to a fully set analysis?.

=IF([Employment Category] = 'TEST',

  SUM({$<[WorkedFlag] = {1} >} Time) - SUM({$<[AdditionalFlag] = {1} >} Time),

  SUM({$<[WorkedFlag] = {1} >} Time))

Thank you.

6 Replies
Anonymous
Not applicable

Hi,

I guess the result will be two expressions, once you have two conditionals

  1.   SUM({$<[WorkedFlag] = {1},[Employment Category] = {'TEST'} >} Time) - SUM({$<[AdditionalFlag] = {1},[Employment Category] = {'TEST'} >} Time), 
  2.   SUM({$<[WorkedFlag] = {1}, [Employment Category] -= {'TEST'} >} Time)) 

Best Regards,

HirisH_V7
Master
Master

Hi,

If should be there  , if  you want a conditional value, or you want to split the condition into two expressions means you can go with mauri suggestion.

What's Your desired output!!

-Hirish

HirisH
“Aspire to Inspire before we Expire!”
Sahal
Creator II
Creator II
Author

I would like as my question was to replace my if statement (if possible) to only include an set analysis insted.

I do NOT want do make 2 expressions.

My desired output would be if i choose a user that have Employment Category "test" but only choose the user and not the column and the value "test" then the workflag - additional time will be shown.

however if i choose a user that do not have "test" then the calculation would be only workflag time.

Sahal
Creator II
Creator II
Author

Can it be as simple as getselectedvalue(employment category) = 'TEST' or something to try to find if there is a value in the field that has "test" and the have the 2 set analysis like i have it?

Not applicable

How's about this...

SUM({$<[WorkedFlag] = {1} >} Time) -

     SUM({$<[AdditionalFlag] = {1}, [Employment Category] = {"Test"} >} Time)

That second sum should only pick up where AdditionalFlag = 1 and Category = Test

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

  1. SUM({$<[WorkedFlag] = {1} >} Time) - SUM({$<[AdditionalFlag] = {1}, [Employment Category]*={'TEST'} >} Time)

Regards,

Jagan.