Reference lines are the horizontal or vertical lines that act as a reference or baseline for a certain measure against which they are compared. For example, if you are analyzing the annual revenue for several companies, you can include a reference line at the average sales value to see how each company performed against the average. Creating a reference line is an extremely useful part of analysis and visualization. In this guide, you will learn how to create a reference line in Tableau.
We’ll be using the sample
Superstore data, available on Tableau repository, to create the reference line. We will be using the variables
Profit as measures and
Sub-Category as dimensions.
Subcategoryvariables into the Columns shelf and the
Salesvariable into the Rows shelf. This is shown in the chart below.
Profitvariable to the Marks shelf and place it in the Color option. This will result in a bar chart where sales is plotted as bars, and the color divergence will represent the profit of each subcategory with respect to the sales.
a. Table: This option adds a reference line to the entire table across all panes.
b. Pane: This option adds a reference line on a per pane basis. This means the computed reference lines are recalculated for each pane in the view.
c. Cell: This option adds a reference line within each cell. This means the computed reference lines are recalculated for each cell in the view.
As an illustration, we will select the Entire Table option that will display the following chart.
SUM(PROFIT)from the drop-down menu. The next tab shows the default aggregation set to Average. We can select any of the multiple options available depending on the aggregation we need to show in the reference line. We’ll go with the default option, as shown below.
a. None: No label will be displayed, which is not a self-explanatory option.
b. Value: This option will display the value of the selected aggregation.
c. Computation: This option will display the computation being performed.
d. Custom: Selecting the custom option will display another box with the option to add a field value, name, computation etc. We can select either one or multiple options.
In this example, we have formatted the reference line as dotted with red color. We also selected the computation as a label and tooltip selection as a value. This will generate the following output.
In this guide, you learned how to add a reference line in Tableau. You also learned the components of the reference line, which will help in deciding which options to select depending upon the type of data you have and the analysis you want to perform.
To learn more about visualization and data analysis using Tableau, please refer to the following guides: