Tableau Tips: Parameters - Reference Line
Updated: Jul 16
In the previous two articles, we learn how to apply parameters with bins and calculated fields. In this article, we’re going to explore how Tableau parameters can be used with reference lines. So, what is a reference line?
Reference line can be defined as a horizontal or vertical line that span the data region of a graph to designate goals or demarcations.
Bullet chart is a good example where a reference line is applied.
Using Superstores data set pre-packaged with Tableau app, we would like to measure actual performance of a field against a target. In this hypothetical case, we will assume the role of data consultant at Superstores. The manager of Superstores has been working hard to reduce the time it takes to ship goods in all States Superstores chain operates, he has some targets (Time to Ship - Target) which he would like all States to meet, and therefore as experts in data analytics we’ve been tasked to help him identify which States are making good progress or have already met the targets.
Therefore, to build our case, we need first to compute actual time to ship goods as depicted by the Superstores data.
Note: Time to ship goods is computed in days.
(Pro tip; In this computation of time to ship goods, note we could have used a parameter in place of 'day' (Application of parameters with calculated fields) to help users choose the unit of time to ship goods as day, week, month, quarter etc).
Parameterize our Target (Time to ship – Target)
Since the manager of Superstores has several targets he would like to monitor, we cannot populate all these without using the parameter. (Recall definition of parameter, where we said parameters give us an opportunity to use fields not in the data, this is a good example).
Creating our parameter;
Let’s build our view
Drag dimension field ‘State’ to the columns shelf.
Drag measure field AVG (Time to Ship – Actual) to the rows shelf.
Add a reference line by right clicking on the axis > Add Reference Line.
On the pop-up menu input as follows;
Select Reference Line.
Show reference line ‘Per Pane’
Under Line choose value as ‘Time to Ship – Target’. (For cases whereby, a parameter has not yet been created, one should choose ‘Create a New Parameter…’ and follow the normal procedure of creating parameters).
Use Average to aggregate the data.
Choose ‘None’ under label.
Under formatting choose the color of your line.
Add color to depict insights
Remember, this is a data visualization project. And therefore, we need to deliver on that framework by adding visual element to spot the differences between the States on target from those lagging behind.
Creating a KPI field to enable this;
Add the calculated field ‘KPI’ to the color shelf.
Change the color appropriately.
With this view, the work of the Superstores manager has been simplified significantly, with parameter, the manager can view which States have achieved his target (time to ship goods) and at the same time he can take appropriate decision for the States lagging behind.
Two points from this view;
On average only two States namely North Dakota and West Virginia shipped products exactly three days or less.
On average District of Columbia is the only State which took 5 days to ship products.
In the next article on applications of parameters, we’re going to learn how parameters can be used with sets. Stay tuned to learn more.
To receive more of Tableau tips and tricks, kindly join our mailing list by subscribing below.
Thank you for reading.