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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
amikm
Helper V
Helper V

Display date for last month in slicer

I am trying to display the date for the last closed month in my Power Bi report as a slicer.

 

For example, If I am in the month of May 2022, I want to select April 2022 as a default value in my slicer

If I am looking at my report in the month of June 2022, then May 2022 should be selected as a default value in my slicer.

 

Note: This selection should be dynamic.

 

Data for that slicer is coming from a Calendar[MonthYear] which has dates from Jan 2022 till Dec 2022

 

Not sure, but we might need to write a dax that can compare the date is closed or not, If not closed then show Today()-1 in the 

format of MMM YYYY

2 REPLIES 2
amitchandak
Super User
Super User

@amikm , you have use workaround, Create a column like this and use that in slicer and save with last month

 

Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"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

@amitchandak , thanks for your reply, After implementing the same, I am getting like this

amikm_0-1653571769095.png

 

If user wants to see for other months then how he can do this , as Slicer is only showing one value, and I don't want the user to clear the values from filter section

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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