Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Highlight period in a graph

Hi community, Is it possible to highlight the background of a specific period in a bar chart based on a slicer selection? For example, when a date is selected from the slicer, the corresponding peri...
  • Shahid12523's avatar
    1 year ago

    Create a measure that returns a value (e.g., the max of your Y-axis) only for the selected period from the slicer.

    HighlightPeriod =
    VAR SelectedPeriod = SELECTEDVALUE(Periods[Period])
    RETURN
    IF(MAX(Periods[Period]) = SelectedPeriod, MAX(YourTable[Value]), BLANK())


    Place this measure as a stacked column/bar behind your main chart (make it semi-transparent with color formatting).

    This creates a shaded/highlight effect only on the selected period.