Forum Discussion

_chris_'s avatar
_chris_
Icon for Helper III rankHelper III
6 years ago
Solved

RANKX Measure always 1

Hi,

 

this question probably was asked many times  but still I do not get it:

 

There is a table having ~200.000 lines.

 

Relevant columns are Date, Customer, Revenue (=Umsatz) etc.

 

Now I want to create a Rank measure:

 

SumUmsatz := CALCULATE(SUM(vbasFASTEC_WaWiVKBelegpositionen[Umsatz]))
Rank Test := RANKX(vbasFASTEC_WaWiVKBelegpositionen, [SumUmsatz])
 

Now my table gives me the following result:

 

 

Actually I expected to get the yearly rank of Umsatz.

 

What am I doing wrong?

 

Thx Christian 

  • Anonymous's avatar
    Anonymous
    6 years ago

    _chris_ 
    There are some differences of using RANKX() in a calculated column and a measure.

     

    Calculated Column:

     

    Column = RANKX('vbasFASTEC_WaWiVKBelegpositionen',[Umsatz],,DESC,Dense)

     

    Measure:

     

    Measure = RANKX(ALL('vbasFASTEC_WaWiVKBelegpositionen'),CALCULATE(SUM([Umsatz])),,DESC,Dense)

     

     

    Paul Zheng _ Community Support Team
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

6 Replies

  • Examine your filter context and adjust as needed with a modifier.

    • _chris_'s avatar
      _chris_
      Icon for Helper III rankHelper III

      This was a very quick response. Thx for this.

       

      However, I do not understand what you mean? I need to adjust the measure itself or in the visual?

      • lbendlin's avatar
        lbendlin
        Icon for Super User rankSuper User

        The measure. Throw in an ALL() somewhere.

         

        Read up on row context and filter context. It will be confusing at first but it is fundamental to enjoying DAX in the long run.