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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
sam1220
Frequent Visitor

HELP: RANKX Function

So I have a table that shows countries. Now I want to get the top 3 countries that are most common in the column.

Capture

So I decided to play around with RANKX, seen multiple threads. Most 'helpful' one is http://community.powerbi.com/t5/Desktop/Ranking-Subjects/m-p/21663#M6731 this one. However, as you can see in the table, all it shows is rank number one.

 

What I've done in cc is COUNTA column. But in the rank column is this:

Measure:                   Measure = COUNT(Table1[Countries])

Rank Column:           Rank = RANKX(ALLSELECTED(Table1), [Measure])

 

Any help is appreciated!

1 ACCEPTED SOLUTION
BhaveshPatel
Community Champion
Community Champion

You can use this two measures for the ranking of the countries:

 

 

Total Rows:=COUNTROWS(Table1)

 

Top Countries := RANKX(ALL(Table1),[Total Rows],,,Dense)

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

View solution in original post

2 REPLIES 2
BhaveshPatel
Community Champion
Community Champion

You can use this two measures for the ranking of the countries:

 

 

Total Rows:=COUNTROWS(Table1)

 

Top Countries := RANKX(ALL(Table1),[Total Rows],,,Dense)

Thanks & Regards,
Bhavesh

Love the Self Service BI.
Please use the 'Mark as answer' link to mark a post that answers your question. If you find a reply helpful, please remember to give Kudos.

Yep, added the measure to the visual filter. Worked like charm. Sorting works great too! Thanks for the help

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.