So you want to build a bar in bar chart? Bar in bar charts are one of my favorite kinds of visualizations. Nerdy, but true. Bar in bar charts provide a fantastic way to compare a measure against a goal or to display two measures against one another. Building a bar in bar chart in Tableau is not incredibly difficult, but it does require a few specifics steps that can be hard to remember if you haven’t built them a lot.
For starters, here is an example of a bar in bar chart. It compares the Seattle Mariners’ wins against their losses over the past 20 years. As you can tell, there have been a few bright spots, but it has been a rough stretch for fans.
Enough show and tell. Let’s jump right into how to build this visualization.
1) Connect to your data source and bring a measure onto the rows shelf.
2) Bring your first measure onto the columns shelf to create a standard bar chart.
3) Drag your second measure into the view and hover over the first measure’s axis until you see two green rulers stacked one on top of the other, then drop the second measure onto the first measure’s axis.
4) Remove the Measure Names field from the Rows Shelf and drop it onto the Color Tab on the Marks Card to distinguish the two different measures with different colors and allow them to stack one on top of the other.
5) Not only do we want the two measures two have different colors, but we also want the two measures to be different sizes. In order to accomplish this we need to grab another instance of the Measure Names field from our Dimensions List and drop it on the Size Tab in the Marks Card.
6) You'll notice that the two measures are now distinguished by different colors and sizes, but are stacked on top of one another. In order for them to both start at the zero point on our y-axis, we need to select the Analysis Tab in the Toolbar, hover over the Stack Marks breakout, and turn stack marks off.
7) Now, you should have a stacked bar chart! All that’s left for you to do is adjust which measure is in the foreground and background by swapping the measures on the Measure Values card, and edit the widths/colors of the bars.
Hopefully this was a helpful walkthrough for you. Happy visualizing!
Posted by Eric Parker