Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ferha_jafri
Partner - Creator III
Partner - Creator III

I want to use set analysys instead of if statement

Hi All,

I have a condition as if(currency='INR',Sum(Salary),Sum(Salary*0.17))

I want to write this statement through set analysis.

Thanks in advance

4 Replies
Anonymous
Not applicable

The if() function here is before the Sum() function. This means that it will decide whether the sum() command is executed or whether nothing is shown.

Set analysis is used to reduce the amount available to the sum() function. If you had the following if statement:

    Sum(if(currency='INR',Salary))

This could be written:

    Sum({<currency={'INR'}>} Salary)

This would say that if the currency is not INR don't sum up the Salary.

The if statement you posted says, if the currency (the only currency !!!) is 'INR', then sum up the salary, else times it by 0.17.

You could do this as follows:

    Sum({<currency={'INR'}>} Salary*if(currency='INR',1,0.17))

Hope this helps.

Jonathan

ferha_jafri
Partner - Creator III
Partner - Creator III
Author

Thank you so much, for ur reply it help me ...

narender123
Specialist
Specialist

Try with this one:

=if(currency='INR',Sum(Salary),Sum(Salary)*0.17)

It means if (currency )='INR' then sum(salary) but if salary is not eqal to 'INR'(else than INR) then sum of (salary)

Thanks.

Narender

Not applicable

FOR--

if(currency='INR',Sum(Salary))

THEN USE--

Sum({<currency={'INR'}>} Salary)

*****************************************************

FOR--
if(currency<>'INR',Sum(Salary))

THEN USE

Sum({<currency-={'INR'}>} Salary)

******************************************************

FOR--


if(currency='INR',Sum(Salary),Sum(Salary*0.17))

THEN USE


Sum({<currency={'INR'}>} Salary) +
Sum({<currency-={'INR'}>} Salary*0.17)

***********************************************************

NOTE - + sign indicates the union, and  -= indicates not equal .