Sliding dates in Power BI

Slicer sliding dates in Power BI

This week I’m going to do something a little bit different in Power BI to kind of give you ideas of ways to construct your visuals. I’m calling this particular idea “the sliding dates chart” where you select your date using a slicer and then watch how the chart change over time.

Power BI page with sliding dates

To set the scene, here’s the chart that I’m talking about:

Image 1 – Bar chart of state’s unemployment rate for a selected date, going from largest to smallest.

There are four parts to this chart: the bar chart at the top, the date slicer below the bar chart on the left, the citation just below the slicer and finally a table of state unemployment rate. The table is to double check the visuals for proper calculations.

The bar chart depicts the unemployment rates of each state from largest to smallest for a selected date. I highlighted two states in pink and blue.

The slicer below the bar chart controls the selection of the date. By sliding the right-hand round know up and down the horizontal line, you can select a date. The goal is to see how the blue and pink states compare throughout time. The selected date is currently set to 2/1/2026 – the latest date available. The next release date will supposedly be 5/22/2026.

2 key things needed

  1. You need a measure that calculates the “maximum” date selected from the date slicer; otherwise, you will get the sum of unemployment rate for each state in the bar chart.
  2. The observation date in the date slicer cannot be a date hierarchy if you want to have a sliding quality to the selection rather than tiles or vertical list of dates to select from.

These requirements are not obvious and I had to use CoPilot to find out how to do this set up. I first dreamed up this idea and then asked if it was possible to create such a visual.

Measure for “max” date

Image 2: First create a measure to calculate the unemployment rate for a selected date. I called the measure “Unemployment Rate (Selected Date)”. Note I placed this measure in the U3 State Unemployment table.

The other checked field is the State.

These two fields are what is used in the bar chart as you will see later.

DAX code for the measure

Here’s the image of the code set up.

Image 3 – DAX code for measure

Here’s the code to copy from:

Unemployment Rate (Selected Date) = 
VAR SelectedDate =
MAX('U3 State Unemployment Seasonally Adjusted'[observation_date])

RETURN
CALCULATE(
MAX('U3 State Unemployment Seasonally Adjusted'[Unemployment Rate]),
'U3 State Unemployment Seasonally Adjusted'[observation_date] = SelectedDate
)

Once you have that, you are now ready to create the bar chart.

Bar chart

I don’t really remember whether the slicer was created first or the bar chart. I think it’s the bar chart.

Image 4: Fields chosen for the bar chart.

Date slicer

In order to get the date slicer to be a kind of sliding slicer rather than tiles or a list of dates arranged vertically it, it is important that the date field (in this case, observation_date) be a straight date field and NOT a hierarchy date.

Image 5: Note that the observation_date chosen is not the date hierarchy form. That is important.

Slicer set up

Image 6: This image shows you the slicer set up. The slicer setting was set to “between” style.

After you do this set up you should have a working slicer where you can slide the right-hand knob to select the date you want to show in the bar chart. Those two visuals should sync up.

Example of changing the date

Here’s is a visual where the date was changed from 2/1/2026 to 7/26/2010.

Image 7 – Date has been changed from 2/1/2026 to 7/26/2010.

Note how the blue and pink states changed positions.

Setting the colors of the bar chart

In case you don’t know how to set the colors of the bar chart, this section will provide you with images of the sections on Power BI to set up the colors.

Image 8 – You want to get into the Columns section of the formatting pane. First set up all of the states to a grey color.

Image 9 – Then to set a state a specific color, change All to your chosen state. And then select the color for your state.

Syncing the bar chart to the slicer

First select the slicer visual. Then go to Format in the menu bar.

Image 10 – Syncing to the slicer

After you select Format, you should get a menu that contains “Edit interactions”. When you select “Edit interactions”, you should get a page full of strange icons:

Image 11: Syncing icons highlighted in yellow

The slicer itself will not have any strange icons or symbols because it is the visual that is driving other visuals. The bar chart has the syncing icon highlighted in yellow. When it is boldfaced as in Image 11 (although maybe hard to see), then the chart or visual is tied to the slicer; otherwise, if the circle with the slash is boldfaced, then the chart/visual will not be tied to the slicer.

Closing

This post should give you enough details to get something started. The syncing of your charts to the slicer takes some practice because it can get tricky.

Similar Posts