Forum Discussion
Dynamic X-Axis on Stacked Column chart (Month/Day/Hour) based on Date Slicer Selection
Hi InmaVM,
Thanks for reaching out to the microsoft fabric community.
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Thank you.
Hi InmaVM
The accepted overlay approach works — I've shipped it myself — but it tends to age badly: every formatting tweak has to be done three times, mobile layout gets fragile, and "invisible" visuals can still capture hover/tooltips. For future readers, here is a single-visual version building on johnt75's field parameter idea, with the full recipe:
1. Create a field parameter (Modeling → New parameter → Fields) with the three granularities: 'Date'[Month], 'Date'[Date], 'Time'[Hour]. Put the parameter in the X-axis of ONE stacked column chart.
2. Add this measure:
Active Granularity =
VAR lvl =
SWITCH ( TRUE (),
ISFILTERED ( 'Date'[Day] ), 2, // Day slicer set → show hours
ISFILTERED ( 'Date'[Month] ), 1, // Month slicer set → show days
0 // only Year → show months
)
RETURN
IF ( SELECTEDVALUE ( 'Granularity'[Granularity Order] ) = lvl, 1, 0 )
3. Drag [Active Granularity] into the visual-level filters of the chart and set "is 1". The parameter now switches automatically with the slicers — no bookmarks, no overlays.
Three gotchas that bite in practice:
- Use 'Date'[Date] (real dates) for the day level, not day-of-month. If the Month slicer ever allows multi-select, "day 5" of two different months would otherwise collapse into a single column.
- Give Hour a numeric sort column (0–23) and Month its usual sort key, or the axis will sort alphabetically.
- Test cross-highlighting from other visuals: interactions can flip ISFILTERED. If that misfires in your layout, point the slicers at a dedicated slicer table and reference those columns in the SWITCH.
Hope this helps whoever lands here next.