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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
paulwalker
Creator III
Creator III

Create buckets based on the count of category

Hi Community,

I have sample data, can you please help me to create buckets like top10, top20, top30 and above 30... etc

PFA,

Labels (1)
2 Replies
BrunPierre
Partner - Master II
Partner - Master II

I didn't completely grasp it, but perhaps this could offer some help.

Data:
LOAD * FROM FoodSales;

Join
LOAD *,
'Top'& Left(CatToCount, Index(CatToCount, '<')-1) as "Category Bucket";

LOAD Category,
Class(Count(Category) ,10) as CatToCount
Resident Data
Group By Category;

DROP Field CatToCount From Data;
JonnyPoole
Former Employee
Former Employee

Here is an example with class() and aggr() and rank() to bucket the performance of a dimension  [Sales Rep ID]  against a measure  ( sum(Sales)):

JonnyPoole_0-1712002325697.png

 

 

aggr('Top' & right(class(rank(sum(Sales)),10),2),[Sales Rep ID])