Forum Discussion

tomwolswijk's avatar
tomwolswijk
Helper I
6 years ago
Solved

Rank date in PowerBI

Hi,

 

I'm looking for a DAX formule to rank the date kolomn. No extra filters on Client ect, just rank the date.

Every month new data is loaded in the PowerBI model. Now i want to add a Kolomn so that 1 = newest month, 2 = month before, ect. Can someone help me on this?

 

Table:

MonthClientAmount
jan-201100
feb-201122
feb-2011
mar-201140

 

Outcome:

MonthClientAmountRANK
jan-2011003
feb-2011222
feb-20112
mar-2011401
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hello @tomwolswijk ,

    You can test this calculated column.

    Rank = 
    RANKX (
        'Table',
        RANKX ( 'Table', YEAR ( 'Table'[Date] ),, DESC, DENSE ) * 100
            + RANKX ( 'Table', MONTH ( 'Table'[Date] ),, DESC, DENSE ),
        ,
        ASC,
        DENSE
    )

    6.png

    More details can be found here.

    Best regards

    Stephen Tao

    If this post helps,then consider Accepting it as the solution to help other members find it faster.

7 Replies