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
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
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.

Top Solution Authors