Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Convert if statement to Set Analysis

Can this be converted to Set Analysis?

if(SUM(EXTENDED_RETAIL) >=500, sum(EXTENDED_RETAIL)*.05, sum(EXTENDED_RETAIL)*.02  )



1 Solution

Accepted Solutions

Re: Convert if statement to Set Analysis

no set expression, but maybe helpful:


SUM(EXTENDED_RETAIL)*(.05+(sum(EXTENDED_RETAIL)<500)*.03)


regards


Marco



5 Replies
oknotsen
Honored Contributor III

Re: Convert if statement to Set Analysis

No, but you could use the statement in your script and create an extra field for the outcome so you no longer have to do the calculation in your front-end.

May you live in interesting times!

Re: Convert if statement to Set Analysis

no set expression, but maybe helpful:


SUM(EXTENDED_RETAIL)*(.05+(sum(EXTENDED_RETAIL)<500)*.03)


regards


Marco



Not applicable

Re: Convert if statement to Set Analysis

Marco,

The " + " in the set equation represent the "OR" condition?

Lyndon

Re: Convert if statement to Set Analysis

In your case your comparing the results after the Aggr so you need calculate the sun() in the script then you could use the same in set analysis

Not applicable

Re: Convert if statement to Set Analysis

It works!