cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
)
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

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

SupaJ68 Frequent Visitor
Frequent Visitor

Re: Rank

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

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 125 members 1,341 guests
Please welcome our newest community members: