Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
Try nested if condition or do it at script level, don't think class function would be useful in your case.
Thank you.
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.
You can try nested if to resolve this
,if(Qauntity>=1000 and Qauntity <=18999,Bucket1,If(Qauntity >=1000 and Qauntity<= 7000,Bucket2)).....as Buckets
Thank you Jagan.
Hi Hari,
If you got the answer for this, please close this thread.
Regards,
Jagan.
Thank you jagan.