Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
aausten22
Helper I
Helper I

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?

1 ACCEPTED SOLUTION

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
)
Ritaf1983_0-1689557191383.png

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



View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

 @aausten22 

 

you can create a date column in pq then use dax to create a column

Column = DATEDIFF('Table'[Custom],TODAY(),MONTH)+1
 
pls see the attachment below

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Ritaf1983
Super User
Super User

Hi @aausten22 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

What I am wanting to achieve is an ordering system that starts with the current month as 1 and numebring backwards to 12

 

So the column would look like this:

DateOrder
Jun 231
May 232
Apr 233
Mar 234

 

So when the month changes, the order changes as well. So if we go into July then it would look like the following:

 

DateOrder
Jul 231
Jun 232
May 233
Apr 234

 

This would be an automatic change so that visuals and slicers are all the same

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
)
Ritaf1983_0-1689557191383.png

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



Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.