Dual-axis charts, also known as combination charts, allow you to compare two different measures on the same graph. This is particularly useful when you want to visualize relationships between two variables that have different scales or units of measurement. In this section, we will cover the following:

  1. Understanding Dual-Axis Charts
  2. Creating a Dual-Axis Chart
  3. Synchronizing Axes
  4. Customizing Dual-Axis Charts
  5. Practical Example
  6. Exercises

  1. Understanding Dual-Axis Charts

Dual-axis charts are powerful tools for visualizing data because they allow you to:

  • Compare two different measures.
  • Use different chart types for each measure (e.g., bar and line).
  • Highlight relationships and trends between the measures.

Key Concepts

  • Primary Axis: The main axis on which the first measure is plotted.
  • Secondary Axis: The additional axis on which the second measure is plotted.
  • Synchronization: Aligning the scales of the primary and secondary axes to make comparisons easier.

  1. Creating a Dual-Axis Chart

Step-by-Step Guide

  1. Connect to Data Source: Open Tableau and connect to your data source.
  2. Drag Measures to Rows: Drag the first measure to the Rows shelf.
  3. Drag Measures to Columns: Drag the second measure to the Columns shelf.
  4. Create Dual-Axis: Right-click on the second measure on the Rows shelf and select "Dual-Axis".
  5. Synchronize Axes: Right-click on the secondary axis and select "Synchronize Axis".

Example

Let's create a dual-axis chart to compare Sales and Profit over time.

1. Connect to the Sample - Superstore data source.
2. Drag the `Order Date` field to the Columns shelf.
3. Drag the `Sales` field to the Rows shelf.
4. Drag the `Profit` field to the Rows shelf, next to the Sales field.
5. Right-click on the `Profit` axis and select "Dual-Axis".
6. Right-click on the secondary axis (Profit) and select "Synchronize Axis".

  1. Synchronizing Axes

Synchronizing the axes ensures that both measures are on the same scale, making it easier to compare them. This is particularly important when the measures have different units or scales.

How to Synchronize Axes

  1. Right-click on the secondary axis.
  2. Select "Synchronize Axis".

  1. Customizing Dual-Axis Charts

Changing Chart Types

You can use different chart types for each measure to make the visualization more effective.

  1. Click on the Marks card for the first measure and select the desired chart type (e.g., Bar).
  2. Click on the Marks card for the second measure and select a different chart type (e.g., Line).

Formatting Axes

  1. Right-click on the axis you want to format.
  2. Select "Format" and adjust the settings as needed.

Adding Labels and Tooltips

  1. Drag the desired fields to the Label and Tooltip shelves on the Marks card.
  2. Customize the labels and tooltips as needed.

  1. Practical Example

Let's create a dual-axis chart to compare Sales and Profit over time using different chart types.

Step-by-Step Guide

  1. Connect to Data Source: Open Tableau and connect to the Sample - Superstore data source.
  2. Drag Order Date to Columns: Drag the Order Date field to the Columns shelf.
  3. Drag Sales to Rows: Drag the Sales field to the Rows shelf.
  4. Drag Profit to Rows: Drag the Profit field to the Rows shelf, next to the Sales field.
  5. Create Dual-Axis: Right-click on the Profit axis and select "Dual-Axis".
  6. Synchronize Axes: Right-click on the secondary axis (Profit) and select "Synchronize Axis".
  7. Change Chart Types:
    • Click on the Marks card for Sales and select "Bar".
    • Click on the Marks card for Profit and select "Line".
  8. Format Axes: Right-click on the axes and select "Format" to adjust the settings.
  9. Add Labels and Tooltips: Drag the desired fields to the Label and Tooltip shelves on the Marks card.

Example Visualization

1. Connect to the Sample - Superstore data source.
2. Drag `Order Date` to the Columns shelf.
3. Drag `Sales` to the Rows shelf.
4. Drag `Profit` to the Rows shelf.
5. Right-click on the `Profit` axis and select "Dual-Axis".
6. Right-click on the secondary axis (Profit) and select "Synchronize Axis".
7. Click on the Marks card for Sales and select "Bar".
8. Click on the Marks card for Profit and select "Line".
9. Right-click on the axes and select "Format" to adjust the settings.
10. Drag the `Sales` and `Profit` fields to the Label and Tooltip shelves on the Marks card.

  1. Exercises

Exercise 1: Create a Dual-Axis Chart

Task: Create a dual-axis chart to compare Sales and Quantity over time.

  1. Connect to the Sample - Superstore data source.
  2. Drag Order Date to the Columns shelf.
  3. Drag Sales to the Rows shelf.
  4. Drag Quantity to the Rows shelf.
  5. Right-click on the Quantity axis and select "Dual-Axis".
  6. Right-click on the secondary axis (Quantity) and select "Synchronize Axis".
  7. Change the chart type for Sales to Bar and for Quantity to Line.
  8. Format the axes and add labels and tooltips.

Solution:

1. Connect to the Sample - Superstore data source.
2. Drag `Order Date` to the Columns shelf.
3. Drag `Sales` to the Rows shelf.
4. Drag `Quantity` to the Rows shelf.
5. Right-click on the `Quantity` axis and select "Dual-Axis".
6. Right-click on the secondary axis (Quantity) and select "Synchronize Axis".
7. Click on the Marks card for Sales and select "Bar".
8. Click on the Marks card for Quantity and select "Line".
9. Right-click on the axes and select "Format" to adjust the settings.
10. Drag the `Sales` and `Quantity` fields to the Label and Tooltip shelves on the Marks card.

Exercise 2: Customize a Dual-Axis Chart

Task: Customize the dual-axis chart created in Exercise 1 by adding a reference line for average Sales and changing the color of the Quantity line.

  1. Add a reference line for average Sales.
  2. Change the color of the Quantity line to red.

Solution:

1. Right-click on the Sales axis and select "Add Reference Line".
2. In the Reference Line dialog box, select "Average" and click OK.
3. Click on the Marks card for Quantity.
4. Click on the Color shelf and select red.

Conclusion

In this section, you learned how to create and customize dual-axis charts in Tableau. You now know how to:

  • Create a dual-axis chart.
  • Synchronize axes.
  • Customize chart types, axes, labels, and tooltips.

These skills will help you create more effective and insightful visualizations by allowing you to compare multiple measures on the same graph. In the next module, we will explore using parameters to add interactivity to your visualizations.

© Copyright 2024. All rights reserved