Forum Discussion
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
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
4 Replies
- Ritaf1983
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- aausten22
Helper I
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:
Date Order Jun 23 1 May 23 2 Apr 23 3 Mar 23 4 So when the month changes, the order changes as well. So if we go into July then it would look like the following:
Date Order Jul 23 1 Jun 23 2 May 23 3 Apr 23 4 This would be an automatic change so that visuals and slicers are all the same
- Ritaf1983
Super User
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
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- ryan_mayu
Super User
you can create a date column in pq then use dax to create a column
Column = DATEDIFF('Table'[Custom],TODAY(),MONTH)+1pls see the attachment below