In my previous article we saw how to display 2 measures on a dual axis. Sometimes displaying multiple trend lines on the same axis in Tableau is necessary. In this article we will see how to achieve this requirement.
Measure Names and Measure Values in Tableau
Tableau automatically creates Measure Names and Measure Values in the Dimensions and Measures section. These two fields are created as soon as you connect to the data source.
Measure Names contains the names of all the Measures in your data source and appears in the Dimensions section. Measure Values contains the all the measures in your data source and appears in the Measures section.
These two columns are very helpful, if you want to display all the measures in your data source. We will use these two columns to display multiple trend lines.
First, let us see how trend lines are displayed, if individual measures are dropped on the row shelf
Displaying multiple trend lines for different measures
- This example will use Sample – Superstore.xls This data source comes with Tableau installation and is located under My Tableau Repository/datasources
- To connect to the datasource, launch Tableau Desktop, under Connect select Excel and browse to the file Sample – Superstore.xls. For specific steps on data connection visit How to connect to data in Tableau
- On the Sheet, drag Order Date from the Dimensions and drop it on the Columns shelf. It will appear as Year. Now drag the measures Quantity,Profit and Sales on the rows shelf. Observe the resulting chart, it will appear like the below
You will see that the trend lines for Quantity,Profit and Sales are displayed on the separate axis. You can display 2 of them on the same axis by using dual axis but one trend line will still be displayed on the separate axis.
Our objective is to display them together.
Displaying multiple trend lines on the same axis
- Create a new worksheet, by right clicking on the sheet icon at the bottom.
- Drag/drop Order Date on the Columns shelf.
- Drag Measure Values from the Measures section and drop on the Rows .
- Drag Measure Names from the Dimensions section and drop it on the Rows shelf. Again drag Measure Names from the Dimensions and drop it on the Label card.
- If you don’t want to display Discount and Number of Records, you can drag them out of the Measure Values on the left.
- Create a Quick filter on the Measure Names, this will help in displaying lines by using the filter
Chart will appear like the one below
You can see that multiple trend lines got displayed on the same axis.
Notice, Number of Records and Discount fields, even though not displayed on the chart, are displayed in the filter.This may confuse users.
If you want to remove them completely, right click on the Measures section and select Hide all unused fields.
Update : 10/4/2018
How to Hide all unused fields
To remove Number of Records and Discount from the Filter, navigate to Measures in the data pane.
If you don’t see any white space below Measures, click on the Measures border and drag it up.
Go to the white space below Measures, right-click and select Hide All Unused Fields
On the View, hide the filter card and Show it again. This will remove the Number of Records and Discount field from the filter.
4 thoughts on “Displaying multiple trend lines on the same axis in Tableau”
Thank you, thank you, thank you!!! This was exactly what I needed to find. Seems like this should be easier.
I tried the above exercise, was very useful, but i could not find ‘Hide all unused fields’ option in the measures section when i right clicked on the measures value.
Can u tell me how to do it.
I have added an update to my blog to explain – How to hide all unused fields.
Hope you find it useful.
Thanks a lot Chandraish, it worked.