Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

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
Highlighted
Creator II
Creator II

Re: IF() to Set Analysis?

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,

Highlighted
Master
Master

Re: IF() to Set Analysis?

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!”
Highlighted
Creator
Creator

Re: IF() to Set Analysis?

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.

Highlighted
Creator
Creator

Re: IF() to Set Analysis?

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?

Highlighted
Not applicable

Re: IF() to Set Analysis?

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

Highlighted
MVP & Luminary
MVP & Luminary

Re: IF() to Set Analysis?

Hi,

Try this

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

Regards,

Jagan.