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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It 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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.