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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
kirbynguyen
Helper II
Helper II

Ranking Per Row in a Matrix

Hello,

 

I have data that when put in a Matrix looks like this (keep in mind the data isn't just one row per value, there are multiple rows per combination, so each value in each cell is an aggregation):

 Apple   Banana   Celery   Donuts   Earth   Fork
A113218254130
B24834282149
C311032112225
D153148252028
E474419213738
F324330353617

 

What I want is to rank each value by row from highest to lowest, so the matrix i would like to have would be:

 Apple   Banana   Celery   Donuts   Earth   Fork
A625413
B462351
C261543
D621453
E126543
F415326

 

Data would look something like this:

Date    Name    Category    Value
1/1/2021AApple10
1/1/2021ABanana20
1/1/2021ACelery9
1/1/2021ADonuts20
1/1/2021AEarth35
1/1/2021AFork22
1/1/2021AApple1
1/2/2021AApple0

So, the values in the matrix are aggregations of the rows. The date doesn't matter in this context.

 

Please help. Thanks in advance!

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@kirbynguyen 

You can use the following measure to get the desired ranking.

Ranking = 
IF( 
    HASONEVALUE(Table2[Category]) && HASONEVALUE(Table2[Name]),
    RANKX(
        ALLSELECTED(Table2[Category]),
        CALCULATE(SUM(Table2[Value]))
    )
)

Fowmy_0-1621463744956.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

1 REPLY 1
Fowmy
Super User
Super User

@kirbynguyen 

You can use the following measure to get the desired ranking.

Ranking = 
IF( 
    HASONEVALUE(Table2[Category]) && HASONEVALUE(Table2[Name]),
    RANKX(
        ALLSELECTED(Table2[Category]),
        CALCULATE(SUM(Table2[Value]))
    )
)

Fowmy_0-1621463744956.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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