Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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
Partner - Master

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
Employee
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])