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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
admin11
Memorable Member
Memorable Member

Hpw to modify expression " Current month = format(today(),"mmm-yyyy") " to last month ?

Hi All

 

I have post a question on :-

 

https://community.powerbi.com/t5/Desktop/How-to-make-button-label-display-current-month-March-2021/m...

 

@amitchandak  offer me below expression work fine :-

Curr month = format(today(),"mmm-yyyy")

 

Now i try to modify the above expression to display last month :-

Curr month -1 = format(today()-1,"mmm-yyyy")

 

But it does not work. Hope some one can help me.

 

Paul

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @admin11 

According to your description and DAX formula, I think you can try this measure to get the last month using the Format() function:

Measure =

FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),"mmm-yyyy")

And place this measure into a card chart:

v-robertq-msft_0-1614843073437.png

 

And you can get what you want.

 

Best Regards,

Community Support Team _Robert Qin

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

4 REPLIES 4
jaideepnema
Solution Sage
Solution Sage

Hi @admin11 ,

Change your DAX Expression as shown below:

Previous Month = FORMAT(EDATE(NOW(),-1),"MMM-YYYY")

 

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

v-robertq-msft
Community Support
Community Support

Hi, @admin11 

According to your description and DAX formula, I think you can try this measure to get the last month using the Format() function:

Measure =

FORMAT(DATE(YEAR(TODAY()),MONTH(TODAY())-1,DAY(TODAY())),"mmm-yyyy")

And place this measure into a card chart:

v-robertq-msft_0-1614843073437.png

 

And you can get what you want.

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-robertq-msft 

Thank you very much , your approach very flexible.

Paul

amitchandak
Super User
Super User

@admin11 , for last month use eomonth

 

Curr month -1 = format(eomonth(today(),-1),"mmm-yyyy")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.