5. How to Create Two Charts in One


Including two charts in one is a common visualization technique. In this lesson, we'll learn how to combine a 100% stacked bar chart with a line chart.

To explore more Kubicle data literacy subjects, please refer to our full library.


Two charts in one

- In Tableau, it's easiest to build two charts separately and then combine them
- The two charts must share one axis, such as time
- After creating both charts, right click on one axis and select Dual axis
- This will create two charts in one
- Both charts are given separate menus in the Marks card, which can be used to format each chart
- To switch the order of the charts, adjust the position of the pills in the rows shelf


In this lesson, I want to see if the fees generated over time are dependent on the split between the four divisions. To do this, I'm going to create a chart similar to the one on screen that includes two charts in one. A line chart, which shows total fees by week, and a bar chart that splits these fees into the various divisions, showing each division as a percentage of the total. So how do we create this in tableau? Let's start by creating our line chart.

So I'll take the sum of value and drag in to rows.

And then I'll take the date time posting, and put this in columns. And I'll select week.

And this gives me my line chart.

Now I need to add my bar chart.

So again, I'll take the sum of value, and this creates two different charts within one visualization. On the second chart, I'll hit the drop down, I'll select a quick table calculation and go for percent of total.

Unfortunately, this doesn't calculate the percentage of total value by week, it calculates the percentage of total value for the whole screen.

So we'll need to change this by going back to the drop down, going to compute using, and table down.

And this now gives me 100% for each week, which is exactly what I want.

In the max card, you can see that we now have a couple of different drop down values, we have All, that can change the format of both chats at the same time, we have sum of value for the line chart, and then another sum of value for the second chart, which would be the bar chart. So I'll flip to a bar chart.

And I'd also color these bars by division.

I'll make sure feet earner is linked, select division and drag on to color.

Within size I'll select manual, and make sure there's a reasonable gap between each bar.

That looks pretty good.

Now it's time to create one chart from these two charts. To do so, right click on the axis and select dual axis.

And now we have the bar chart and the line chart in one visualization. However, the bar chart should ideally be behind the line chart. To do this, let's simply switch the order of the two sum values in the rows shelf. So let's select and drag.

Another now the line chart is in front of the bar chart. And we have the visualization that we want.

From the chart, it's clear that the fees by division do not vary drastically from week to week. But the actual fees generated does vary quite a bit. Therefore, it's pretty easy to conclude that the changes in revenue are not due to the changes in revenue mix by division.

In the show me drop down, you might have seen that there is an option for dual combination. You can always use this to create two charts in one, but I like to build each chart separately, as I have done here.

In this example, I have two different metrics, percentage of total and value, which is US dollars. And you can see these on both axes either side of the charts.

Sometimes you'll want to combine two charts that have the same unit of measurement, and you'll want to sync both axes. To do so simply right click on the axes and go to synchronize axes.

You may also want to change the mark type.

And to do so we can simply go back to the marks card, hit the drop down and go to say, circle which replaces my lines with circles. I find the line and bar chart combination easiest to read, so I'll keep it to line for now.

Tableau Essentials
Creating Visualizations in Tableau


My Notes

You can take notes as you view lessons.

Sign in or start a free trial to avail of this feature.

Free Trial

Download our training resources while you learn.

Sign in or start a free trial to avail of this feature.

Free Trial