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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
MeiYing
Helper I
Helper I

Breaking ties in power bi rank

My table visual has Year, Month, Customer, Country, and Total qty, and I want it to display top 10 customers order by their total qty in each month. I have created the total qty measure, Customer rank measure, and top 10 customer measure as following. 

 

total qty = sum('Top Cust'[QTY])
Customer Rank =RANKX(ALL('Top Cust'[CUSTOMER]), [total qty], ,DESC,DENSE)
Top10 Customers Qty = IF('Top Cust'[Customer Rank] <= 10, [total qty], BLANK())
And in the filter pane, I put the [Customer] field to filter by using Top N function which in this case I use Top 10 by value Top 10 Customers Qty. 
 
However, it returns 11 rows which include two customers whose total qty are having ties. In this case, I want measure to check by alphabetical order of Customer. For e.g., Customer ABC and DEF having ties, but only customer ABC record will be displayed in top 10. Can anyone help me with this? Thank you so much!
1 REPLY 1
rajendraongole1
Super User
Super User

Hi @MeiYing - Modify your customer ranking measure as below ensuring ranking takes into account the alphabetical order 

 

Customer Rank =
RANKX(
ALL('Top Cust'[CUSTOMER]),
[total qty],
[total qty] + 1/(1 + RANKX(ALL('Top Cust'[CUSTOMER]), [CUSTOMER], , ASC)),
DESC,
DENSE
)

 

Update your Top 10 Customer Qty Measure as below by calling Customer Rank

 

Top10 Customers Qty =
IF(
[Customer Rank] <= 10,
[total qty],
BLANK()
)

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

Find out what's new and trending in the Fabric community.