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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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