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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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