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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Maciek048
New Member

Month number

Hello, I need to have in PowerBI a column which will display number of month in callendar.

At this moment I have an Callendar table created by 

CALENDAR = CALENDAR(DATE(2018.,1.,1),EOMONTH(Today(),0)) function.
Maciek048_0-1675090507423.png

 

Now I need a cloumn which will display number of month started from courrent month, for eg.:
 
January 2023 (this month) - 0
December 2022 - 1
November 2022 - 2
October 2022 - 3
September 2022 - 4
etc.
 
It is crucial to have data alligned with every future months and updated with past. 
Every next current month will get "0", and previous "1", and next prev. one "2" etc. till end of created callendar table (the numbers are not from 1-12 range).
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Maciek048 

try like:

NewColumn = 
DATEDIFF([DATE], TODAY(), MONTH)

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Maciek048 

please try

Number of Month =
RANKX ( 'CALENDAR', FORMAT ( 'CALENDAR'[Date], "YYYYMM" ),, Asc, DENSE ) - 1

FreemanZ
Super User
Super User

hi @Maciek048 

try like:

NewColumn = 
DATEDIFF([DATE], TODAY(), MONTH)

Thanks it works. I needed only to add "-" before statement to achieve exactly what I want.

Column = -(DATEDIFF(TODAY(), [DATE], MONTH))

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.