Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dual if statement with multiple conditions

Hi I am trying to add multiple if conditions for the below task as hand:

if d<30

result=([90+(Rent-8000)]/1000)*3

else if 30<d<60

result=([100+(Rent-8000)]/1000)*3

else if 60<d<90

result=([110+(Rent-8000)]/1000)*3

I tried this using multiple if statement in the script editor LOAD. However, I get error if I try to use multiple conditions under one if statement.

Could any one please help me to work on the right approach towards this issue ?

Thanks!

13 Replies
oknotsen
Master III
Master III

That screenshot is not showing me anything to prove to me that at the moment of doing a resident load on NTMs there are not multiple values of for either "d" or "Rent".

As a calculation does not randomly make up numbers (or at least not this basic calculation), I see no other explanation.

May you live in interesting times!
Not applicable
Author

Sorted now. There was some issues because of synthetic table. Thanks

Anil_Babu_Samineni

LOAD

d,

Rent,

If(d<30, (90+((Rent-8000)/1000)*3), If(d>=30 and d<60, (100+((Rent-8000)/1000)*3), If(d >= 60 and d<90, (110+((Rent-8000)/1000)*3),If(d >= 90 and d<120, (120+((Rent-8000)/1000)*3),If(d >= 120 and d<150, (140+((Rent-8000)/1000)*3),If(d >= 150 and d<180, (150+((Rent-8000)/1000)*3),If(d >= 180 and d<210, (160+((Rent-8000)/1000)*3),(170+((Rent-800)/1000)*3)))))))) as FieldName

Resident NTMs;

Here, You have mentioned single 800 only. Is that is correct? or you may miss to add one more 0 like 8000

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Thanks for pointing out, fixed that too