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

rank across group and across all

DAX beginner help, please. I have the following data:

OrgTypeScore
ABCZ32
ABCY29
ABCX33
ABCW30
DEFZ38
DEFY39
DEFX31
DEFW36
GHIZ34
GHIY34
GHIX34
GHIW34

I want to Rank by Type, then average all the Ranks by Org, then Give an Overall Rank. How do I do this?

TIA

2 REPLIES 2
v-huizhn-msft
Employee
Employee

Hi @Anonymous,

I am confusing about "I want to Rank by Type", you want to rank Score by Type? If it is, I try to reproduce your scenario as follows.


I create a calculated column using the formula.

Rank = RANKX(FILTER(Test,Test[Type]=EARLIER(Test[Type])),Test[Score],,ASC,Dense)


>>then average all the Ranks by Org, then Give an Overall Rank.

Could you please list an examle? How to average all the Ranks by Org, and give an overall rank for what?

 

average = CALCULATE(SUM(Test[Rank])/COUNTA(Test[Org]),ALLEXCEPT(Test,Test[Org]))

Please see the following screenshot.

1.PNG

If this doesn't resolve your issue, please share more details.

Best Regards,
Angelia

Hi @Anonymous,

 

This code will do it the other way if @v-huizhn-msft's version is not what you need

 

Two new calculated columns

 

Rank = 
VAR OrgColumn = test[Org]
RETURN RANKX(
    FILTER(
        Test,
        test[Org]=OrgColumn
        ),Test[Score],,DESC,Dense)

and

Average = 
var TypeColumn = 'test'[Type]
RETURN 
    CALCULATE(
            AVERAGE(test[Rank]),
            FILTER(
                'test',
                test[Type]=TypeColumn
                )
               )

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

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.