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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Arunraj89
Frequent Visitor

Setting a default values in slicer based on months

Hi Guys,

 

I have a scenario wherein the selected value in the slicer has to be the current month and previous month. For example, if the users are checking currently, Sep 2020 and Aug 2020 has to be the default selections. In the next month, it has to be Oct 2020 and Sep 2020. 

 

The below displayed is the data for reference.

 

MonthSales
Jan-20$1,346,931
Feb-20$242,824
Mar-20$1,543,120
Apr-20$286,320
May-20$1,296,335
Jun-20$1,991,486
Jul-20$1,237,445
Aug-20$680,516
Sep-20$1,284,505

 

Thanks for the help!

4 REPLIES 4
amitchandak
Super User
Super User

@Arunraj89 , In you date table you need to have a column like this and select "Last 2 Months". Month year is column you already have for month year

 

Month Type = Switch( True(),
Date([Date]) >= eomonth(Today(),-2)+1 && Date([Date])<= eomonth(Today(),0),"Last 2 Months" ,
[Month Year]
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank Amit! But, the client wants to see the name of months in Slicer. If i use the solution that you gave, i will be seeing "Last two months" and name of other months as items in the slicer. @amitchandak 

hi @Arunraj89 - There is no out of the box feature in Power BI to automatically set the latest month in a date slicer.

You would need to follow the approach of creating a calculated column with a value like "Current month" or "Last 2 months" and setup the report as seen in the below video: 

https://www.youtube.com/watch?v=pCgK-Ze3nhA

 

Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!

Proud to be a Super User!



@Arunraj89 , I doubt having an option like that. 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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