Displaying multiple trend lines on the same axis in Tableau

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

  1. This example will use Sample – Superstore.xls This data source comes with Tableau installation and is located under My Tableau Repository/datasources
  2. 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
  3. 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

MultipleMeasuresOnSeparateAxis

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

  1. Create a new worksheet, by right clicking on the sheet icon at the bottom.
  2. Drag/drop Order Date on the Columns shelf.
  3. Drag Measure Values from the Measures section and drop on the Rows .
  4. 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.
  5. If you don’t want to display Discount and Number of Records, you can drag them out of the Measure Values on the left.
  6. 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

MultipleMeasuresOnSameAxis

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

  • KnitterPam says:

    Thank you, thank you, thank you!!! This was exactly what I needed to find. Seems like this should be easier.

  • Hi Chandraish,
    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.

    Thanks

    • Chandraish Sinha says:

      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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.