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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.