Building Side by Side Bar Chart in Tableau: 3 Step by step best practices
Blog | March 13, 2018 | By Vijai Narasimha
Woow!! Comparison charts. These charts are famous from times immemorial!
As discussed in the previous blog, Bar In Bar Chart In Tableau – 3 Methods , comparison charts are very common and most important charts for any data. Tableau also can create some very special comparison charts. One such chart is Side by Side Bar Chart or referred to as Shared Axis Chart.
The concept of Side by Side Bar Chart is very straightforward. We focus on typically 2 to 3 measures (or more*) with all measures placed right next to the other for easy comparison.
When it comes to following these step by step best practices, it is good to have colors and labels to differentiate the measures. To demonstrate this, a small sample data is selected (that has been used in other blogs).
There are 2 measures: Actual and Forecast. The dimension name is used for slicing and dicing.
Side by Side Bar chart in Tableau uses Measure Names and Measure Values.
Again a quick recap on Measure Names and Measure Values:
a) Measure Names and Measure Values are Auto generated fields in Tableau.
b) The Measure Value field acts as shelf (or bucket) for all the measures and also as a placeholder for incoming measures.
c) Measure Names and Measure Values are Name-Value pairs for each measure.
d) In most cases, Measure Names controls the visualization. It plays a lot of roles: Filtering, creating Color buckets, providing Label,s changing the Size etc..
Method 1 – Side by Side Bar Chart in Tableau
1) Use Measure Names on Filters shelf
2) Select the 2 measures (Actual and Forecast) required for this visualization.
(Looking for comparable measures only. Not metrics of different scales. Eg. Revenue in Millions and Percentage of Returns as a % cannot be used for this example. This is the reason to call it a Shared Axis chart – The same scale is shared across multiple measures)
3) Use Measure Values on Rows (or Columns). For Vertical chart, Rows; for a horizontal chart, Columns
(At this point, a new Measure Values shelf is created, both the measures standing together, one behind another). To understand the order of operations, the measure on the top will be at the back (or alphabetically). This measure will eventually come to the left or can be rearranged if needed.
4) Use the Name field on Columns (or Rows) for slicing the aggregation into multiple pieces.
(At this point too, it seems like only one measure is present)
5) To open up the second measure, we need a copy of Measure Names (one more) on the same shelf as the existing Dimension and it has to be placed on the right. (For this example, Measure Names must be placed to the right of Name field. If we consider the order of operations, it travels left to right. So whatever is placed on the left will be executed first)
6) Now for the last step. We can leave this as it is and for many developers this step is optional. But this graph does not appeal quickly. For best practices, differentiating measures with labels is part 1, adding colors will be part 2. This will give a better picture. So, a copy of Measure Names on the Color card.
Method 2 – Side by Side Bar Chart in Tableau
Here we will take a quicker 4 step approach. When we reach the third step, Tableau is smart enough to realize that the developer is trying to create a Side by Side bar chart.
1) Use any measure on the Rows (or Columns). In this case, Actual.
2) Use a Dimension on the Columns (or Rows) for slicing and dicing. For this case, Name field.
3) This is a very important step. We need to pay close attention to this step. Use another measure (of comparable value) close to the existing measure Axis and look for a ** Double Ruler ** indicator or visual cue. For this example, the Forecast field will be brought close to Actual measure axis.
At this juncture, Tableau automatically invokes Measure Names and Measure Values and creates the Side by Side bar.
4) Last step. Use a copy of Measure Names on the Color card.
Method 3 – Side by Side Bar Chart in Tableau
Here we will take the quickest and easiest route. This is an all-time favorite for most Tableau users. For this method, we shall take support from our friend ‘SHOW ME’
1) Keep the SHOW ME drop-down open
2) Use the CTRL key on the keyboard and select (click) at least 1 Dimension and at least 2 Measures together. In this case, the Name field, the Actual field and the Forecast field.
3) Finally select the Side by Side bar chart from SHOW ME. (3rd Visualization on the 3rd Column)
Whatever we needed to achieve in steps is completed in just 4-5 clicks.