Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue in nested if

Hi,

Can someone please help me with this nested if condition in the script.

I want to categorize these days into four sub groups.

i.e., >10 , >31, >61, >91
  
I wrote the if condition but its failing in some cases.

if([Days Past Due] >91, '>91',
        if([Days Past Due] ,'>61',
           if([Days Past Due] ,'>31',
             if([Days Past Due] >10 ,'>10',null())))) as [Days Past Due Range]

Regards,

Sachin

11 Replies
ramoncova06
Specialist III
Specialist III

you are missing a couple of values in your if's

If([Days Past Due] >91, '>91',
        if([Days Past Due] >61,'>61',
           if([Days Past Due] > 31,'>31',
             if([Days Past Due] >10 ,'>10',null())))) as [Days Past Due Range]

Not applicable
Author

Ramon, sorry about the typo, but the requirement is, if the [Days Past Due] value is 32. It should come under the '>10' as well as '>31' bucket. Which won't happen as per the above if condition.

krishna_2644
Specialist III
Specialist III

Try the script in the doc..

output:

Capture2.PNG

ramoncova06
Specialist III
Specialist III

so you want to create a second entry, one per each bucket ?

Not applicable
Author

Hi Chaitanya,

Where is the document attached.

Not applicable
Author

Yeah

krishna_2644
Specialist III
Specialist III

its attached.

Capture1.PNG

Not applicable
Author

But the requirement is:

For ex when the value is 36 it should come under >10 as well as >31 bucket.

Not applicable
Author

But the requirement is:

For ex when the value is 36 it should come under >10 as well as >31 bucket.