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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AGuyCalledGeral
Regular Visitor

Add rank column to table based on number of occurrences

I have a table and count the number of occurrences of a column value in a measure. This works fine.

 

CountOfColumn = COUNTROWS(FILTER(Table; Table[Column] = Table[Column]))

 

Now I would like to add a rank based on the count. so that the the entry with the most occurrences has rank 1, the next 2 etc.

This would make it possible to show the top n most frequent items.

 

I tried

 

RankByCountOfColumn = RANKX(Table; [CountOfColumn])

 

But the rank is always the same for each column although the counts are diffent.

1 ACCEPTED SOLUTION

@AGuyCalledGeral

 

This should work with the [column]

 

RankByCountOfColumn =
RANKX ( ALL ( Table[Column] ); [CountOfColumn] )

View solution in original post

3 REPLIES 3
Vvelarde
Community Champion
Community Champion

@AGuyCalledGeral

 

hello, try adding ALL.

 

RankByCountOfColumn = RANKX(All(Table); [CountOfColumn])




Lima - Peru

Hello Victor, no, it does not help, the rank is still always the same.

@AGuyCalledGeral

 

This should work with the [column]

 

RankByCountOfColumn =
RANKX ( ALL ( Table[Column] ); [CountOfColumn] )

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors