Machine Learning & Big Data Blog

Tableau Online: Plotting Multiple Axes on the Vertical Axis, Pt. 2

Banner
3 minute read
Walker Rowe

Here we show how to plot more than one metric on a single vertical axis in Tableau Online. Metrics are called Pills in Tableau, since they are shaped like a pill.

(This article is part of our Tableau Online Guide. Use the right-hand menu to navigate.)

The problem

For the beginner, Tableau Online is frustrating because, when you put two metrics on the rows (horizontal), it draws two charts as the default behavior. Users of Microsoft Excel are used to Excel doing the desired behavior, plotting multiple axes, automatically.

In Part 1 of this tutorial, we did that using a union. Here we do that by taking two data points from a single view. We’ll create charts with:

Generate your data

You can run this Python code to create some data and then run this SQL command to add a revenue column. Or just pick any data that you have and follow these general instructions.

create view revenue as select salesdate, product, quantity, quantity * random() * 10 as revenue from sales;

Plot two data points on left vertical axis

Create a new data source.

Drag the Salesdate to Columns and then change the date from YEAR() to exact date.

This next step is not exactly intuitive. Drag Measure Names onto the Color Mark. Drag the Measure Values to Rows. This creates a legend to the right for each metric and plot each metric on the chart. (That is the frustrating part for beginners as if you drag each metrics onto Rows it makes a separate chart for each metrics.)

You’ll also want to remove SUM(Number of Records) as that’s not too useful, but Tableau Online adds it to the chart automatically. So, scroll down and find it and remove it from here:

The chart now looks like this:

Zoom in for a closer view:

Plot two data points on dual axis

The chart above looks OK. You could change the label Value to Revenue/Quantity. But let’s use another technique and plot one metric on the left axis and the other on the right axis.

So, instead of using Measure Values drag Revenue and Quantity onto Rows.

Tableau makes two charts. So click Sum(Revenue) and then select Dual Axis to make one instead.

The resulting chart is a bit crowded:

So, edit the quantity axis to force values to a range that does not overlap with the revenue range.

Set a fixed range.

Now it’s easier to read:

Zoom in for a closer view.

Learn ML with our free downloadable guide

This e-book teaches machine learning in the simplest way possible. This book is for managers, programmers, directors – and anyone else who wants to learn machine learning. We start with very basic stats and algebra and build upon that.


These postings are my own and do not necessarily represent BMC's position, strategies, or opinion.

See an error or have a suggestion? Please let us know by emailing blogs@bmc.com.

Business, Faster than Humanly Possible

BMC empowers 86% of the Forbes Global 50 to accelerate business value faster than humanly possible. Our industry-leading portfolio unlocks human and machine potential to drive business growth, innovation, and sustainable success. BMC does this in a simple and optimized way by connecting people, systems, and data that power the world’s largest organizations so they can seize a competitive advantage.
Learn more about BMC ›

About the author

Walker Rowe

Walker Rowe is an American freelancer tech writer and programmer living in Cyprus. He writes tutorials on analytics and big data and specializes in documenting SDKs and APIs. He is the founder of the Hypatia Academy Cyprus, an online school to teach secondary school children programming. You can find Walker here and here.