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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.