Forum Discussion
Visualization (Buttons and Slicers)
- 1 year ago
You could just create another conditional formatting measure but this time should be applied to the callout value of the buttons.
Slicer Highlight Color = IF ( SELECTEDVALUE ( MonthsOnly[Month Short] ) IN VALUES ( Dates[Month Short] ), "white" --#ffffff for hexadecimal )
This approach is simple to set up, requires no complex DAX, and is very intuitive for the end-user.
1. Build a Proper Calendar Table
The foundation of any good report is a solid calendar table. Make sure you have a table in your model with at least the following columns. This table should be marked as a date table and have a relationship to your data.
- Date (a continuous list of dates)
- Year
- Quarter (e.g., "Q1", "Q2")
- Month Name
- Quarter Number (for sorting)
- Month Number (for sorting)
2. Create a Hierarchy
A formal hierarchy will make the slicer "aware" of the relationship between the fields.
- Go to the Model view in Power BI Desktop.
- In the Data pane, find your Calendar table.
- Drag the Quarter column and drop it directly onto the Year column.
- Drag the Month Name column and drop it onto the Quarter column you just added to the hierarchy.
- Rename the hierarchy to something logical, like "Date Hierarchy".
3. Configure the Slicer Visual
- Add a Slicer visual to your report canvas.
- Drag the entire Date Hierarchy you just created from your Calendar table into the slicer's Field well.
- To get the button-like appearance from your screenshot, go to the Format your visual pane:
Select Slicer settings > Style and choose Tile.
You can adjust the layout and appearance further under the Values formatting options.
This single slicer will now provide a guided, drill-down experience:
- Initial View: The slicer will show only the Years.
- Drill to Quarters: When a user clicks on a year (e.g., "2025"), the slicer will automatically replace the years with the quarters for 2025 (Q1, Q2, Q3, Q4).
- Drill to Months: If they then click on a quarter (e.g., "Q2"), the slicer will update again to show only the months within that quarter (Apr, May, Jun).
Users can navigate back up the hierarchy using the "Drill up" arrow in the slicer's header. This design makes it impossible to create a conflicting selection and eliminates the need for any complex bookmarks or DAX.
If this explanation and solution resolve your issue, please like and accept the solution.
Hi Sandip_Palit, thank you for your help!
Unfortunately, I don’t think a drill-down slicer is what I’m looking for at the moment. I’d like the slicer to display all Years, Quarters, and Months directly, so users can click on any of them without needing to drill down step by step.
I’d really appreciate your help with this setup.
Thank you!