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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
NiteshS
Helper I
Helper I

Ranking value column in a table based on multiple other column

Dear All,

Can you please guide me in developing a DAX code to rank the "Point Estimate" column in the below table based on the other three columns? Thanks in advance. @Fowmy 

StudyNameSubgroupOutcomePointEstimateRank
Study 1OverallResponse >=90%1.62
Study 1OverallConstipation3.45
Study 1OverallCEIs2.03
Study 1Stage IIIInfections2.14
Study 1Stage IVHematologic AE1.01
Study 2Stage IVDiarrhea3.56
Study 2OverallHypertension3.57
Study 2BRCA+Nausea3.68
Study 2BRCA-Anemia3.810
Study 2Stage IIIHematologic AE3.79
Study 2Stage IIIHematologic AE3.911
1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @NiteshS ,

According to your description, here's my solution.

1. If based on the StudyName column, rank PointEstimate column.

Add a new column, the DAX statement is as following:

 

Column 1 =
RANKX (
    FILTER ( 'Table', 'Table'[StudyName] = EARLIER ( 'Table'[StudyName] ) ),
    'Table'[PointEstimate],
    ,
    DESC
)

 

2. If based on the StudyName and Subgroup column, rank PointEstimate column.

Add a new column, the DAX statement is as following:

 

Column 2 =
RANKX (
    FILTER (
        'Table',
        'Table'[StudyName] = EARLIER ( 'Table'[StudyName] )
            && 'Table'[Subgroup] = EARLIER ( 'Table'[Subgroup] )
    ),
    'Table'[PointEstimate],
    ,
    DESC
)

 

3. If based on the StudyName, Subgroup and Outcome column, rank PointEstimate column.

Add a new column, the DAX statement is as following:

 

Column 3 =
RANKX (
    FILTER (
        'Table',
        'Table'[StudyName] = EARLIER ( 'Table'[StudyName] )
            && 'Table'[Subgroup] = EARLIER ( 'Table'[Subgroup] )
            && 'Table'[Outcome] = EARLIER ( 'Table'[Outcome] )
    ),
    'Table'[PointEstimate],
    ,
    DESC
)

4. Final output

vkalyjmsft_0-1662342887490.png

Best Regards,
Community Support Team _ kalyj

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-yanjiang-msft
Community Support
Community Support

Hi @NiteshS ,

According to your description, here's my solution.

1. If based on the StudyName column, rank PointEstimate column.

Add a new column, the DAX statement is as following:

 

Column 1 =
RANKX (
    FILTER ( 'Table', 'Table'[StudyName] = EARLIER ( 'Table'[StudyName] ) ),
    'Table'[PointEstimate],
    ,
    DESC
)

 

2. If based on the StudyName and Subgroup column, rank PointEstimate column.

Add a new column, the DAX statement is as following:

 

Column 2 =
RANKX (
    FILTER (
        'Table',
        'Table'[StudyName] = EARLIER ( 'Table'[StudyName] )
            && 'Table'[Subgroup] = EARLIER ( 'Table'[Subgroup] )
    ),
    'Table'[PointEstimate],
    ,
    DESC
)

 

3. If based on the StudyName, Subgroup and Outcome column, rank PointEstimate column.

Add a new column, the DAX statement is as following:

 

Column 3 =
RANKX (
    FILTER (
        'Table',
        'Table'[StudyName] = EARLIER ( 'Table'[StudyName] )
            && 'Table'[Subgroup] = EARLIER ( 'Table'[Subgroup] )
            && 'Table'[Outcome] = EARLIER ( 'Table'[Outcome] )
    ),
    'Table'[PointEstimate],
    ,
    DESC
)

4. Final output

vkalyjmsft_0-1662342887490.png

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thank you.

 

PREVIEW
Yes, I am close to my answer. Is there a way I can give a dynamic row number that gets updated based on the selected filter/slicer?
 
OR
 
Is there a way to get rid of the ties? I need continuous ranking for the point estimate.
 
 
 
NiteshS
Helper I
Helper I

Thank you @Fowmy  for the response.

Fowmy
Super User
Super User

@NiteshS 

Please check out my video on the same topic: https://youtu.be/8aDSztj9pmU

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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