Forum Discussion
Make Slicer Default to Specific Month
I would like to find a way to make my monthly slicer default to the most recent month whenever the report is opened, but also allow users to change the month selected. I’d like to be able to do this with DAX rather than adding a calculated column or additional tables. So far, the closet method I’ve found is this tutorial with the below DAX
Master Slicer Defaults in Power BI with DAX Functions | Scenario-based interview questions
‘MainTable’[Month] = IF ( NOT ISFILTERED('YourTable'[Category]), CALCULATE ( SUM('YourTable'[Sales]), 'YourTable'[Category] = "Electronics" ), SUM ( 'YourTable'[Sales] ) )
But I don’t want to Calculate or SUM any information, I just want my slicer to default to the most recent month. Is there a way to modify this DAX for that purpose? I’m open to changing the DAX monthly if it won’t update automatically, but at the very least I’d like to able to set the slicer to a specific month.
Thank you
1 Reply
- rampie
Kudo Commander
A slicer default can't really be set with DAX, but you can get the same result natively. Try putting your date column (not the auto date hierarchy) in the slicer and switching the style to Relative date, set to "This month". Or use Date picker anchored to Last date if you want it to follow your latest data instead of today. Either way it opens on the current month and users can still change it.
https://learn.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range
Hope this helps!
https://www.linkedin.com/in/richard-ampie-218a07247/