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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

RANKX Function

Hi all, I'm trying to figure out a way to use the RANKX function to rank a sales column in my table. I do not want to rank this by a certain category but rather rank them in groups (1-10) evenly distributed across the dataset by the sales number. For example group 1 would contain the lowest sales amounts and group 10 would contain the highest sales amount. I can't seem to figure out how to accomplish this without defining a category to rank by which I don't want to do. Thanks for any replies!!

6 REPLIES 6
lbendlin
Super User
Super User

consider using PERCENTILEX instead.

Anonymous
Not applicable

Thanks for the reply. The PERCENTILEX function is (Table, Expression, K). Obviously I would reference my table first but what is Expression and K? How would I use this to create a 1-10 numeric range?

Anonymous
Not applicable

Hi @Anonymous 

 

Thanks to @lbendlin for the correct direction. If I understand it correctly, you can try a new column with below DAX.

RankGroup = 
VAR vSalesAmt = 'Table'[SalesAmt]
RETURN
SWITCH(TRUE(),
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.1),1,
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.2),2,
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.3),3,
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.4),4,
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.5),5,
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.6),6,
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.7),7,
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.8),8,
vSalesAmt<PERCENTILEX.INC('Table', 'Table'[SalesAmt], 0.9),9,
10)

vjingzhanmsft_0-1712909123843.png

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Anonymous
Not applicable

Thank you @Anonymous and @lbendlin for the reponses. I believe the PERCENTILEX.INC function is the right way to go. Can you explain why you use expressions 0.1, 0.2 ,0.3, etc...? When I apply this formula to my specific case I only get a rank group from 8-10.

how much data do you have?  Needs to be statistically significant.

calculate for k=0.1, k=0.2, k=0.3 etc.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.