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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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