# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Highlighted
Contributor III

## Error in multiple if condition

I want to implement  a logic that if  %HPP_Summary_List contains  'HPPD' then if the field  Pensionseinrichtung has a value  'CONTI' it will calculate  [Total Commit] *0.2 , similarly for other values in it will calculate the sum total commit multiplied with a given percentage.

ELSE if the  %HPP_Summary_List does not contain HPPD but oTher values, it will just return the value of Ttoal commit

The script is giving error:

if(match(subfield(subfield(%HPP_Summary_List,'_',1),'-',1, 'HPPD' and

(If(Match([Pensionseinrichtung], 'CONTI'),Sum(TOTAL {\$<Pensionseinrichtung = {'CONTI'}, [Total Commit] *0.2) or

If(Match([Pensionseinrichtung], 'MER'),Sum(TOTAL {\$<Pensionseinrichtung = {'MER'}, [Total Commit] *0.99),

[Total Commit],'Unknown' )))

Labels (7)

• ### Script and Expressions

1 Solution

Accepted Solutions
Contributor III

Solved

5 Replies
Contributor II

## Re: Error in multiple if condition

Hi how are you??

your problem is that not only are you missing some closure of '()', but you are using set analysis statements in the script, this should not be done, the analsysis set is used in the graphics once the model is loaded in memory .

Now you want to use this scritp ??? you'll have to think about it better, you may have to use several load residents or proceeds, group by ...

it's more complex to do it in the script, luck!

Regards!!!!

Partner

## Re: Error in multiple if condition

hi,

there are many problems with the syntax, I corrected your expression in syntax

if(
match(subfield(subfield(%HPP_Summary_List,'_',1),'-',1),'HPPD') and

(
If(Match([Pensionseinrichtung], 'CONTI'),Sum(TOTAL {\$<Pensionseinrichtung = {'CONTI'}>} [Total Commit] *0.2)) or

If(Match([Pensionseinrichtung], 'MER'),Sum(TOTAL {\$<Pensionseinrichtung = {'MER'}>} [Total Commit] *0.99))),
[Total Commit] ,'Unknown' )

Bye

Contributor III

## Re: Error in multiple if condition

Even though the code is not giving syntax error it is not giving me right results.For example for hppd data source Conti will have a value of total commit *.2 which is 8000 and for MER it should be total commit *.99= 3960 where total commit =40000.

But for some reason it is returning the total commit as 40000 because the condition fails to satisfy

Contributor III

## Re: Error in multiple if condition

Even though the code is not giving syntax error it is not giving me right results.For example for hppd data source Conti will have a value of total commit *.2 which is 8000 and for MER it should be total commit *.99= 3960 where total commit =40000.

But for some reason it is returning the total commit as 40000 because the condition fails to satisfy

Contributor III

Solved