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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Earl40
Helper I
Helper I

Get previous month value from formatted date field

I currently have  date/time column  (short date format 11/27/2023). I then have a column to format it to just show as  "November 2023" (FORMAT(date, "MMMM YYYY") . Is there a way I can add to the formula to change it to automatically show the prior month so it shows October 2023

 

Thank you in advance

1 ACCEPTED SOLUTION

Hmm. With the DATEADD function, it will only have dates if there is a previous month in your existing date column - from the docs https://learn.microsoft.com/en-us/dax/dateadd-function-dax. So I think the dateadd function might have been the issue.

 

To get around this, you can try use FORMAT(EOMONTH('calendar'[Date], -1), "MMMM YYYY")

View solution in original post

3 REPLIES 3
vicky_
Super User
Super User

You can use the following formula: 

last month formatted = 
var lastMonthsDate = DATEADD('calendar'[Date], -1, MONTH)
return FORMAT(lastMonthsDate, "MMMM YYYY")

 

vicky__0-1701122000949.png

 

Thanks @vicky_ . i tried the formula but the end result just comes up with blank values for the column

Hmm. With the DATEADD function, it will only have dates if there is a previous month in your existing date column - from the docs https://learn.microsoft.com/en-us/dax/dateadd-function-dax. So I think the dateadd function might have been the issue.

 

To get around this, you can try use FORMAT(EOMONTH('calendar'[Date], -1), "MMMM YYYY")

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors