Forum Discussion

aausten22's avatar
aausten22
Icon for Helper I rankHelper I
3 years ago
Solved

Creating sequential numbering system based of Today's Month

Currently I have a dataset with a list of months formatted as "MMM YY"

 

What I am wanting to achieve is a numbering system as a calculated column that will add the numbers 1-12 based on the current month we are in

ie: If we are in June 2023 then Jun 23 would have a 1 next to it, May 23 would have 2 ...

This is wanting to also change so that when we go into July 23 the numbers would move accordingly

 

Is this possible?

  • Hi aausten22 
    Add to the calculated column which ranks your dates based on month-year:

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

    It will work dynamically as you mentioned that you need

     

    Link to the sample file 

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly



4 Replies