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: 
Not applicable

Nested if statment not working

Hi

The below if statement is not working. I dont know why. It is only calculating values for the <4 part not the =4 or =5 part.

if([Intervall RD]<'4',[Rörlig Lön]*[Procent RD],

if([Intervall RD]='4',[Rörlig Lön]*%AvBudget,

if([Intervall RD]='5',[Rörlig Lön],0)))

as Utbetalt

I am happy for any help to solve this.

//Fredrik

10 Replies
Not applicable
Author

1) Just remove the quotes:

if ([interval RD] < 4 ......)

2) check also the numbers of this Intervall RD field

Fabrice

Not applicable
Author

I recommend you trying each if separately...

The field [Intervall RD] is numeric??? If it's numeric, so this

if([Intervall RD]<4,[Rörlig Lön]*[Procent RD],

if([Intervall RD]=4,[Rörlig Lön]*%AvBudget,

if([Intervall RD]=5,[Rörlig Lön],0)))

as Utbetalt

israrkhan
Specialist II
Specialist II

might be its getting always < 4, so in that case it will not go to the else part...

make sure you have the [Intervall RD]=4 values.

or do a try to ,

if([Intervall RD]<4,[Rörlig Lön]*[Procent RD],

if([Intervall RD]=4,[Rörlig Lön]*[%AvBudget],

if([Intervall RD]=5,[Rörlig Lön],0)))

Clever_Anjos
Employee
Employee

If you´re using a table, add an expression with [Intervall RD] and check the values this expression can assume

Not applicable
Author

Hi

Intervall RD is numeric and I have values for all [Intervall RD]. I have included a printscreen of the table here. Where it is visible that only calculations for the values [Intervall RD]<4 are being made and null values for [Intervall RD]=4 and [Intervall RD]=5.

Skärmklipp.JPG.jpg

Clever_Anjos
Employee
Employee

Whats the expresion for %AvBudget?

Not applicable
Author

It is a calulated value that I have imported from another table. It is a numerc value that I want to multiply with for the records where [Interval RD]=4

Clever_Anjos
Employee
Employee

Could you post the exact expression?

Not applicable
Author

left join (UtbetBeräkningar)

load *,

if([Intervall RD]<4,[Rörlig Lön]*[Procent RD],

if([Intervall RD]=4,[Rörlig Lön]*%AvBudget,

if([Intervall RD]=5,[Rörlig Lön],0)))

as Utbetalt

resident UtbetBeräkningar;

Written before in the script.

left join (UtbetBeräkningar)

load *,

UtfallTot/SäljBudgetTot as %AvBudget

resident UtbetBeräkningar;

left join(UtbetBeräkningar)

IntervalMatch(%AvBudget) load  [Start Intervall RD], [Slut Intervall RD] resident RDMapping;