Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
else
result=([150+(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!
As i mention below thread, Assume that is not a field. use second condition that is the case. And [] - Indicates single field with in Qlik
Dual if statement with multiple conditions
Instead of "else if" you will have to nest your if-statements.
I am also not sure if "30<d<60" would work to begin with.
For starters, if d is 30 or 60, it would get the highest result, which would be wrong.
Try something like this:
if(d<30, ([90+(Rent-8000)]/1000)*3, if(d<60, ([100+(Rent-8000)]/1000)*3, if(d<90, ([110+(Rent-8000)]/1000)*3, ([150+(Rent-8000)]/1000)*3))) as result,
Tried this but it's giving the below error:
Script Error:
Field not found - <90+(Rent-8000)>
Calculations:
LOAD
d,
if(d<30, ([90+(Rent-8000)]/1000)*3, if(d<60, ([100+(Rent-8000)]/1000)*3, if(d<90, ([110+(Rent-8000)]/1000)*3, ([150+(Rent-8000)]/1000)*3))) as result
Resident RentCal
As i mention below thread, Assume that is not a field. use second condition that is the case. And [] - Indicates single field with in Qlik
Dual if statement with multiple conditions
So apparently Rent is not a field in the table you are using this IF-statement on.
Never EVER start a topic twice again as it results in at least half the people wasting their time on a topic that is already being answered elsewhere.
Dual if statement with multiple conditions
Topic locked.