Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Access the top n% rows of a dataset

How could I simply make a new column called 'Quintile' and assign each row a value 1-5 where the top 20% of rows are assigned 1 in 'Quintile', the next 20% are assigned 2, and so on? Assume that the values I am evaluating are sorted in descending order already, as so why I just need to slice the data apart at these cutoffs and access the row counts accordingly.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

For anyone that comes across this problem I created new columns that calculated each quintile cutoff. Then I created a final quintile column and used this to assign quintile tags. 

 

Calc Quintile = IF('KPI Active'[Productivity Score]>='KPI Active'[Calc Q1 Cutoff],1, IF(AND('KPI Active'[Productivity Score]>='KPI Active'[Calc Q2 Cutoff], 'KPI Active'[Productivity Score]<'KPI Active'[Calc Q1 Cutoff]),2, IF(AND('KPI Active'[Productivity Score]>='KPI Active'[Calc Q3 Cutoff], 'KPI Active'[Productivity Score]<'KPI Active'[Calc Q2 Cutoff]),3, IF(AND('KPI Active'[Productivity Score]>='KPI Active'[Calc Q4 Cutoff], 'KPI Active'[Productivity Score]<'KPI Active'[Calc Q3 Cutoff]),4, IF('KPI Active'[Productivity Score] < 'KPI Active'[Calc Q4 Cutoff],5, 00 )))))

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

For anyone that comes across this problem I created new columns that calculated each quintile cutoff. Then I created a final quintile column and used this to assign quintile tags. 

 

Calc Quintile = IF('KPI Active'[Productivity Score]>='KPI Active'[Calc Q1 Cutoff],1, IF(AND('KPI Active'[Productivity Score]>='KPI Active'[Calc Q2 Cutoff], 'KPI Active'[Productivity Score]<'KPI Active'[Calc Q1 Cutoff]),2, IF(AND('KPI Active'[Productivity Score]>='KPI Active'[Calc Q3 Cutoff], 'KPI Active'[Productivity Score]<'KPI Active'[Calc Q2 Cutoff]),3, IF(AND('KPI Active'[Productivity Score]>='KPI Active'[Calc Q4 Cutoff], 'KPI Active'[Productivity Score]<'KPI Active'[Calc Q3 Cutoff]),4, IF('KPI Active'[Productivity Score] < 'KPI Active'[Calc Q4 Cutoff],5, 00 )))))
m3tr01d
Continued Contributor
Continued Contributor

Hi @Anonymous 
how many rows and columns do you have in that table?

Anonymous
Not applicable

It is going to depend for each time I update it, was hoping to get some help by using countrows / 5, then assigning quintiles in that fasion where number of rows and columns are just variables

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.