Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dimension Buckets

Hi all,

I have a list of product IDs and I want to group them in buckets by spend in descending order. For example, if I have 100 product IDs, I want to group them in 4 buckets ([1-25], [26-50], [51-75], [76-100]) form highest to lowest overall spend. I assume once I have them set as a dimension, I'll be able to run other analysis on the same buckets.

Thanks,

Paul

Labels (1)
3 Replies
alexpanjhc
Specialist
Specialist

then an inlin load should help.

load * inline[

ID, group

1,          [1-25]

2, [1-25]

...

25, [1-25]

26, [26-50]

....

]

;

MayilVahanan
MVP
MVP

HI

Try like this

Load *,

If(ProductID <= 25, '[1-25]', If(ProductID <= 50, '[26-50]', If(ProductID <= 75, '[51-75]', '[76-100]'))) AS Bucket

from tablename; //datasource

hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

My only problem is that I don't want to place them in buckets based on the ProductID, I want to put them in buckets based on spend BY ProductID. Highest 25 spend ProductIDs first, then second 25, etc.

Thanks,

Paul