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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Xandman
Helper II
Helper II

Get Previous Month's Name

I'm trying to get the previous month's NAME of a selected date to appear on a card but, I always get an error when I use this:

 

PreviousMonName = FORMAT(PREVIOUSMONTH(DateTable[Date])-1,"MMMM")
 
Hope someone can guide me on why this isn't working.
 
I'm also planning on getting the previous 2 to 6 months on a card as a label.  I got the previous month value to work with:
 
SubPreviousMonth = CALCULATE([Total Subs],PREVIOUSMONTH(DateTable[Date]))
 
Still trying to find a way to get the 2 to 6 months previous to it.
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Xandman , Try like

calculate(FORMAT(max(DateTable[Date]),"MMMM"),PREVIOUSMONTH(DateTable[Date]))

 

Try like

SubPreviousMonth = CALCULATE([Total Subs],PREVIOUSMONTH(DateTable[Date]))

2nd SubPreviousMonth = CALCULATE([Total Subs],PREVIOUSMONTH(dateadd(DateTable[Date],-1,month)))

last MTD = CALCULATE([Total Subs],DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Xandman , Try like

calculate(FORMAT(max(DateTable[Date]),"MMMM"),PREVIOUSMONTH(DateTable[Date]))

 

Try like

SubPreviousMonth = CALCULATE([Total Subs],PREVIOUSMONTH(DateTable[Date]))

2nd SubPreviousMonth = CALCULATE([Total Subs],PREVIOUSMONTH(dateadd(DateTable[Date],-1,month)))

last MTD = CALCULATE([Total Subs],DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

Thank you! I used the same pattern to get the names too.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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