Tableau: Dynamic Reference Lines
Sometimes it’s useful to compare actual values against a dynamic reference value. For example, I may want to see the months in which the company spent more than £650,000. To do this, we first need to create a parameter:
Right click in the data pane and select ‘create parameter’
In the resulting dialogue box, you’ll want the parameter name to be ‘value’ and the data type should be integer.
The parameter will show in the left hand menu. Click ‘show parameter control’
This will then show in the right hand pane of Tableau
Now that we’ve added a parameter, right click on the axis and select ‘add reference line’. Once you’ve selected this, you can see the reference line is added to the chart.
Next, using the menu attached to the parameter you created, click on ‘create > calculated field’.
The calculation in here simply looks for a true or false, when the sum of cost is greater than the value I set in my parameter, which I called ‘value’
When you apply this, you can drag your new calculated field into the colour block in the left hand pane.
When this is applied, the items below the line, where the condition is false, show in orange. While all data that is ‘true’ shows in blue. This makes it very clear which months exceeded the target value set by the user in the parameter.