Forum Discussion

Nun's avatar
Nun
Resolver I
2 years ago
Solved

Rank DAX formula

Hello,   I have a table, created with  ADDCOLUMNS(SUMMARIZECOLUMNS(Sales[Time Code],Sales[Custmer]),"Total Sales",[amountEUR]). Time code field is linked to a calendar table where there is the s...
  • timalbers's avatar
    2 years ago

    Hi Nun 

    you can achieve this by adding a calculated column to your table using the following DAX:

    rank = 
        RANKX( 
            ALL( table_name ), 
            CALCULATE( 
                SUM( table_name[Total Sales] ), 
                ALL( table_name ), 
                table_name[Customer] = EARLIER( table_name[Customer] ) 
            ), 
            , , DENSE
        )

    Please be aware of replacing "table_name" with the actual name of your table.

     

    If this answer helped you, please consider marking it as solution.

    Thank you!

    Cheers

    Tim