cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SupaJ68 Frequent Visitor
Frequent Visitor

Rank

Hi PBI Experts,

I am trying to rank the data within a table using two different groupings and I am struggling to get the DAX examples on the forum to work for me.  Below is an example of my data and what I am trying to Rank;

 

Any help would be greatly appreciated.

Thanks! JWPBI_Rank_problem.PNG

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Rank

@SupaJ68

 

You can use this calculated column for Type 1

 

RankType1 =
RANKX (
    SUMMARIZE (
        LocationValue,
        [Location],
        "Sum", CALCULATE ( SUM ( LocationValue[Value] ) )
    ),
    [Sum],
    CALCULATE (
        SUM ( LocationValue[Value] ),
        ALLEXCEPT ( LocationValue, LocationValue[Location] )
    ),
    DESC,
    DENSE
)

View solution in original post

Super User
Super User

Re: Rank

@SupaJ68

 

And this one for RANK type 2

See attached file as well

 

RankType2 =
RANKX (
    SUMMARIZE (
        LocationValue,
        [SubLocation],
        "Sum", CALCULATE ( SUM ( LocationValue[Value] ) )
    ),
    [Sum],
    CALCULATE (
        SUM ( LocationValue[Value] ),
        ALLEXCEPT ( LocationValue, LocationValue[SubLocation] )
    ),
    DESC,
    DENSE
)

rannk.png

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Rank

@SupaJ68

 

You can use this calculated column for Type 1

 

RankType1 =
RANKX (
    SUMMARIZE (
        LocationValue,
        [Location],
        "Sum", CALCULATE ( SUM ( LocationValue[Value] ) )
    ),
    [Sum],
    CALCULATE (
        SUM ( LocationValue[Value] ),
        ALLEXCEPT ( LocationValue, LocationValue[Location] )
    ),
    DESC,
    DENSE
)

View solution in original post

Super User
Super User

Re: Rank

@SupaJ68

 

And this one for RANK type 2

See attached file as well

 

RankType2 =
RANKX (
    SUMMARIZE (
        LocationValue,
        [SubLocation],
        "Sum", CALCULATE ( SUM ( LocationValue[Value] ) )
    ),
    [Sum],
    CALCULATE (
        SUM ( LocationValue[Value] ),
        ALLEXCEPT ( LocationValue, LocationValue[SubLocation] )
    ),
    DESC,
    DENSE
)

rannk.png

View solution in original post

SupaJ68 Frequent Visitor
Frequent Visitor

Re: Rank

This works perfectly.  Thank you!!! Smiley Very Happy

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 6 members 989 guests
Please welcome our newest community members: