Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
hariprasadqv
Creator III
Creator III

Stuck with uneven intervel databuckets creation!!!

Hi All,

My data is having a field called quantity,in which i have to create uneven intervel buckets. I know that we can use CLASS() for creating data buckets in even intervales. But I have to create uneven intervels.

Qauntity values are in between 1000 to 18999.

I have to create bucket 1 in between 1000-7000

bucket 2 in between 7000-15000

bucket 3 in between 15000-18999

Thank you

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this in script

LOAD

*,

If(Qauntity >= 15000 AND Qauntity < 18999, '15000-18999',

     If(Qauntity >=7000 AND Qauntity < 15000, '7000-15000',

     If(Qauntity >= 1000 AND Qauntity < 7000, '1000-7000', 'N/A'))) AS Bucket

FROM DataSource;

Hope this helps you.

Regards,

Jagan.

View solution in original post

8 Replies
Not applicable

Try nested if condition or do it at script level, don't think class function would be useful in your case.

hariprasadqv
Creator III
Creator III
Author

Thank you.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this in script

LOAD

*,

If(Qauntity >= 15000 AND Qauntity < 18999, '15000-18999',

     If(Qauntity >=7000 AND Qauntity < 15000, '7000-15000',

     If(Qauntity >= 1000 AND Qauntity < 7000, '1000-7000', 'N/A'))) AS Bucket

FROM DataSource;

Hope this helps you.

Regards,

Jagan.

sujeetsingh
Master III
Master III

You can try nested if to resolve this


,if(Qauntity>=1000 and Qauntity <=18999,Bucket1,If(Qauntity >=1000 and Qauntity<= 7000,Bucket2)).....as Buckets

hariprasadqv
Creator III
Creator III
Author

Thank you Jagan.

MarcoWedel

Custom Filter(unusual range)

Hope this helps

Regards

Marco

jagan
Luminary Alumni
Luminary Alumni

Hi Hari,

If you got the answer for this, please close this thread.

Regards,

Jagan.

hariprasadqv
Creator III
Creator III
Author

Thank you jagan.