Welcome back to my blog. Today I will be showing you how to make a dynamic reference line in Tableau. In the realm of Tableau, reference lines stand as guides, offering a visual anchor to our data visualizations.

Essentially, a reference line is a straight or curved line that extends across a plot area, serving as a benchmark against which data points can be compared. These lines are invaluable tools in the hands of data analysts and visualization enthusiasts, providing a means to highlight key metrics, signify targets, or showcase trends within the data. I am going to show how to allow the user to change where the reference line is depending on their needs.

The first step is to create your graph. In my case I will be making a simple sales bar chart.

The next step is to create a parameter which will be called Target. This parameter needs to be set to a range of integers. Set the max and min to include all your data points.

Next, you need to bring a reference line onto the chart and set the value to the parameter that you created. Here I called mine Target. You should now have a dynamic reference line. Test it by changing the value of the parameter.

I’m going to take this one step further by adding some colour to the chart. I would like the bars above the target to stand out from the rest. If you create a calculated field that says whether each point is above or below the target.

Drag this onto colour and change the colours to highlight what you want to show.

Here is what my chart looks like.

I hope you have found this blog helpful.