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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
Anonymous
Not applicable

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
Anonymous
Not applicable

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.