Today’s blog is a tutorial on how to create a reference band using set actions. We are using the Superstore data sample from Tableau 2021.4. Using set actions we can make the reference lines dynamic that the borders update automatically according to the area you choose in the view.
First we need to build a chart for the reference band. Let’s do a basic line chart for sales over time. Time is continuous of Oder Date.

The idea is to have two reference lines to highlight the area between them. They should be dynamic that we could choose those values by ourself by selecting an area within the chart. To do so, first we want a custom Day create from Order Date. Right click on Order Date (alternative you can click on the small triangle on the right hand side of it) -> Create -> Custom date. Choose Date Value of Days.

Now we have a new measurement which is called Day (of course you can pick any other name). Replace the Day for Order Date on Columns. Create a set of Day (Right click on Day -> Create -> Set). We have Day Set now.
The next task is to identify the maximum and minimum date for the range. They are the borders of the band. It is easily done by calculated fields, separately for the max and the min. We use the Level of Detail to return the maximum and minimum day of the set.


After we have the borders for our band, make sure to drag them into Detail in the Mark Cards. Drag Reference Band of the Analytics panel into Day and per Table. In Edit window, adjust the vales of “Band From” and “Band To” respectively to the Max Date in Range and Min Date in Range we just calculated. (This is the reason they need to be in the Mark Cards so you can see them here). The other settings are up to your preferences.

Now to make our Reference Band dynamic, the final step is to set up the Set Actions for the worksheet. On the menu bar, go to Worksheet -> Actions. Choose Add Action -> Change Set Values.

Now if you drag the mouse over an area, you should be able to see your reference band updated.
Good luck and have fun.