Forum Discussion

GWoodhouse's avatar
GWoodhouse
New Member
3 years ago
Solved

Problems with DAX RankX

I have a table containing Country names and Priority Orders

Country Priority

UK          1

US          1

NL          2

 

and another table containing a measure that sums a value

What I want is

Rank    Priority  Country   SumofValue

1          1            US           1000

2          2            NL            900

3          1            UK            800

 

But what I am getting is the following because it's ranking by country within the Priority groups

Rank    Priority  Country   SumofValue

1          1            US           1000

1          2            NL            900

2          1            UK            800

 

My DAX is al follows

Country Rank =
Rankx(
        all(Country[CountryName]),
        MySumMeasure,
        ,desc
        ,Dense
    )
 
Where am I going wrong?
Thanks in advance
  • hi GWoodhouse 

    try like:

    Country Rank =
    Rankx(
            all(Country[CountryName]),
            CALCULATE[MySumMeasure], ALL(Country[Priority]),
            ,desc
            ,Dense
        )

3 Replies

  • hi GWoodhouse 

    try like:

    Country Rank =
    Rankx(
            all(Country[CountryName]),
            CALCULATE[MySumMeasure], ALL(Country[Priority]),
            ,desc
            ,Dense
        )
      • FreemanZ's avatar
        FreemanZ
        Icon for Super User rankSuper User

        [MySumMeasure], as a measure, has an implicit CALCULATE, which converts the row context - Priority, to filter context.