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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Get month number of previous month

OK - I need to get the number of the previous month as an integer.

 

I currently get teh current month using:

 

MONTH(NOW())

 

but I cannot simply subtract 1 as if the current month was January (ie. 1) then the previous month would come out as 0 instead of 12 (december).

 

Any thoughts?

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

actuaylly just came up with this - is this OK?

 

test = IF(Month(NOW())>1,MONTH(NOW())-1,12)

View solution in original post

@Anonymous,

 

You may use DAX below as well.

m =
MONTH ( TODAY () - DAY ( TODAY () ) )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

actuaylly just came up with this - is this OK?

 

test = IF(Month(NOW())>1,MONTH(NOW())-1,12)

@Anonymous,

 

You may use DAX below as well.

m =
MONTH ( TODAY () - DAY ( TODAY () ) )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.