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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
SpanishEnjoyer
New Member

Using function Rank or Rankx for grouped rankings

Hello,

I have two tables related to each other by ID. One table has information about dates when a equipment failed and how it did and the other table contains information about all equipments (id,category, room, building)  just like this:

Eq IDMonth yearFailure Mode
0012-2024-
0023-2024-

002

6-2024-
0048-2024-
0032-2024-

 

Eq IDCathegoryRoom Building
001Electrical10A
002Electrical11A
003Mechanical10A
004Mechanical12B

I already created a metric that counts how many times an equipment appears in table Failures:

 

Count_Failures = CALCULATE(COUNTROWS('Table Failures')
 
Also I used the function RANK to know the rankings of each equitment
 
Ranking  = RANK(DENSE,FILTER(ALL('Table Equipments'),'Table Equipments'[ID Eq]<>BLANK()),ORDERBY([Count_Failures],DESC))
 
However, I need to know for example, the ranking of equipment per cathegory or per room like the table below , it doesn´t matter if  it´s neccesary to created two new metrics. 
 
Eq IDCathegoryRoomTotal FailuresRank per CathegoryRank per Room
001Electrical10121
002Electrical11211
003Mechanical10111
004Mechanical12111

 

NOTE: I would like to keep using the metric Count_failures because it can changes over time instead of a calculated column in the table Equipments wich will have an static value.

 

 

3 REPLIES 3
rajendraongole1
Super User
Super User

Hi @SpanishEnjoyer -Create a new measure that ranks the equipment based on the number of failures within its respective category

Rank_Per_Category =
RANKX(
ALLSELECTED('Table Equipments'[ID Eq]),
[Count_Failures],
,
DESC,
DENSE
)

 

create another measure for rank for each room as below:

Rank_Per_Room =
RANKX(
ALLSELECTED('Table Equipments'[ID Eq]),
[Count_Failures],
,
DESC,
DENSE
)

 

this way you can achieve, hope it works.





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

Proud to be a Super User!





Thanks for your answer,  but the new metrics works as the metric Ranking that is already created.  It doesn´t rank the equipment by cathegory or room.

 

Anonymous
Not applicable

Hi @SpanishEnjoyer ,

 

I don't quite understand your grouping logic, if the room ordering 001 and 003 should be the same, they should both return 2.

vtianyichmsft_0-1727922705645.png

 

Please detail your needs and demonstrate the expected results.

 

Best regards,
Community Support Team_ Scott Chang

 

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.