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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
jamoroso
Helper I
Helper I

Set default date on slicer

Hi,

 

I have a date slicer that contains a rolling last 13 Month End Dates. I want the slicer to default to the latest month end date when the report is opened. I want the remaining 12 month end dates to still show in the slicer, so they can be selected if needed. For example, on April 1st, the below slicer will show dates from 03/31/2021 thru 03/31/2022 and the default selection should be 03/31/2022 with the option to change it. 

 

Thanks.

 

jamoroso_0-1647287904000.png

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@jamoroso 

One thing you can do is have a column in your Dates table that tags the rows you want as the default selection with "Current Month".  Since it will recalculated whenever the model is refreshed, when the meaning of current month changes, the rows marked that way will also change meaning the dates for the new current month will be selected.
This is the code for my sample Dates table.

 

Dates = 
ADDCOLUMNS(
    CALENDARAUTO(),
    "Month End Date", EOMONTH([Date],0),
    "Month End Date Default", IF ( EOMONTH ( [Date], 0 ) = EOMONTH ( TODAY(),0),"Current Month",FORMAT(EOMONTH ( [Date],0),"m/d/yyyy"))
)

 

Then I set the sort by on the [Month End Date Default] to be sorted by [Month End Date].  Put [Month End Date Default] in a silcer and select 'Current Month':
2022-03-14_13-42-28.png

Next month, when the dates roll over, the slicer will look like this but 'Current Month' will stay selected.

2022-03-14_13-47-46.png

View solution in original post

3 REPLIES 3
jdbuchanan71
Super User
Super User

@jamoroso 

One thing you can do is have a column in your Dates table that tags the rows you want as the default selection with "Current Month".  Since it will recalculated whenever the model is refreshed, when the meaning of current month changes, the rows marked that way will also change meaning the dates for the new current month will be selected.
This is the code for my sample Dates table.

 

Dates = 
ADDCOLUMNS(
    CALENDARAUTO(),
    "Month End Date", EOMONTH([Date],0),
    "Month End Date Default", IF ( EOMONTH ( [Date], 0 ) = EOMONTH ( TODAY(),0),"Current Month",FORMAT(EOMONTH ( [Date],0),"m/d/yyyy"))
)

 

Then I set the sort by on the [Month End Date Default] to be sorted by [Month End Date].  Put [Month End Date Default] in a silcer and select 'Current Month':
2022-03-14_13-42-28.png

Next month, when the dates roll over, the slicer will look like this but 'Current Month' will stay selected.

2022-03-14_13-47-46.png

Thank you. I was able to add this is. 

TomMartens
Super User
Super User

Hey @jamoroso ,

 

at the current moment Power BI does not support default values for slicers.

Maybe you want to create an idea on ideas.powerbi.com or upvote an existing one.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.