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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FaisalKarawalla
Frequent Visitor

Ranking Based on Two Columns

Hello,

 

Am trying to come up with a logic that will help me in creating a ranking.

 

So the rank depends on two variable percentages (Columns). Lets Say Percentage 1 and Percentage 2.

 

The desirable situations for determining the rank are combination of:

1. Percentage 1 should be heighest.

2. Percentage 2 should be lowest.

 

Is there any formula which I can create a measure with, if not any suggested work arounds?

 

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @FaisalKarawalla ,

Please try below steps:
1.Create an auxiliary column

HP_Column =
VAR rank_by_kpi =
    RANKX ( 'Table', 'Table'[KPI Percentage],, DESC )
VAR rank_by_death =
    RANKX ( 'Table', 'Table'[Death Percentage],, ASC )
VAR ct_rows =
    COUNTROWS ( 'Table' ) + 1
RETURN
    rank_by_death + DIVIDE ( rank_by_kpi, ct_rows )

vbinbinyumsft_0-1659520438816.png

 

2.Rank by the new auxiliary column

Rank_Num =
RANKX ( 'Table', 'Table'[HP_Column],, ASC )

vbinbinyumsft_1-1659520457232.png

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-binbinyu-msft
Community Support
Community Support

Hi @FaisalKarawalla ,

Please try below steps:
1.Create an auxiliary column

HP_Column =
VAR rank_by_kpi =
    RANKX ( 'Table', 'Table'[KPI Percentage],, DESC )
VAR rank_by_death =
    RANKX ( 'Table', 'Table'[Death Percentage],, ASC )
VAR ct_rows =
    COUNTROWS ( 'Table' ) + 1
RETURN
    rank_by_death + DIVIDE ( rank_by_kpi, ct_rows )

vbinbinyumsft_0-1659520438816.png

 

2.Rank by the new auxiliary column

Rank_Num =
RANKX ( 'Table', 'Table'[HP_Column],, ASC )

vbinbinyumsft_1-1659520457232.png

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you so much!

Works like a charm!

daXtreme
Solution Sage
Solution Sage

Hi there

 

Can you please show us (a picture?) an example of what you'd like to achive and what your input is? It'll be easier to come up with something useful. Thanks.

Thank you for the response, find the picture attached.

 

FaisalKarawalla_0-1659344809429.png

 

The end result is to get a list of the most signifincant hospitals on which if the KPI percentage is improved it will result in the most drastic change on the overall average KPI permorfance. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors