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 you need to display multiple trends line on the same axis. 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 taskbar 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 shelf. 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.
  4. If you don’t want to display Discount and Number of Records then you can drag them out of the Measure Values on the left.
  5. 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 that, Number of records and Discount columns, 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.

Leave a Reply

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