KNOWLEDGE BASE

Creation of a Grouped Bar Chart


Published: 15 Mar 2017
Last Modified Date: 20 Jul 2023

Question

How to create grouped bar charts, also known as side-by-side bar charts. 

Environment

Tableau Desktop

Answer

To create a grouped bar chart or side-by-side chart, ensure that the desired pill is set to Continuous so that the continuous field that anchors the horizontal location of each bar, forming the group.

 
CLICK TO EXPAND SOLUTION

Example 1: Monthly Side by Side Bar Charts for Multiple Years

  1. In Tableau Desktop, connect to Superstore sample data.
  2. Drag Sales to the Rows shelf.
  3. Drag Order Date to the Columns shelf.
  4. On the Columns shelf, right-click YEAR(Order Date), and then select Month (May).
  5. Drag Order Date to the Columns shelf again.
  6. On the Marks card, select Bar from the drop-down menu.
  7. Drag Order Date to the Color card.
To view the steps showed in the below video, please expand the above section. Note: the video has no sound.
 
CLICK TO EXPAND STEPS

Example 2: Using a Dimension

Step 1: Create a calculated field
  1. Create a calculated field:  Select Analysis > Create Calculated Field.
  2. In the Calculated Field dialog box, complete the following steps.
    1. For Name, type Market List.
    2. In the Formula box, build the following formula:

      CASE [Market]
      WHEN "Central" THEN 1
      WHEN "East" THEN 2
      WHEN "South" THEN 3
      WHEN "West" THEN 4
      ELSE 4.5
      END

  3. Confirm that the status message indicates that the formula is valid, and then click OK.
Step 2: Build the view
  1. Drag "Product Type" to the Columns.
  2. Right-click "Market List" and select Convert to Dimension.
  3. Right-click "Market List" and select Convert to Continuous.
  4. Drag "Product type" and "Market List" to Columns.
  5. Drag "Inventory" to the Rows.
  6. On the Marks card, on the drop-down list of view types, select Bar.
  7. Drag "Market" to Color.
Step 3: Adjust the bar sizes: 
  1. Click the Size mark card.
  2. Select Fixed so that Tableau Desktop automatically adjusts the size to minimum and the maximum default data. 
  3. (Optional step) Right-click the x axis and unselect "Show Header" if you do not want to display the Quarters. Or, right-click the axis and select Edit Axis... > Remove the title.
To view the steps showed in the video below, please expand the above section.
Note: the video has no sound.
 
CLICK TO EXPAND STEPS

Example 3: Stacked Side-by-side Bar Charts

  1. Drag at least 3 fields (at least one measure and one dimension) to the Rows & Columns. In this specific example, we will drag: States to Columns, Profit and Margin to Rows. 
  2. Click the Side-by-side Show Me Bar Chart example. 
  3. Replace Measure Values from Colors by a Dimension to Color. In this example, Product Type was used. 
TIP: From this view, you can un-stack the bars by clicking again on the Side-by-side bar icon from the Show Me option.
To view the steps showed in the video below, please expand the above section.
Note: the video has no sound.
 
CLICK TO EXPAND STEPS

Example 4: Stacked with Dates

Step 1: Build the view: 

  1. Drag "Market" to Columns
  2. Right-click and drag "Date" to Columns.
    • In the pop-up window, select QUARTER(Date) as a continuous measure.
  3. Drag "Inventory" to Rows
  4. Filter the view to the 2005 Year. 
  5. Add "Product Type" to Color.
  6. Change the chart to Bar Chart. 

Step 2: Adjust the bar sizes: 

If the bar charts are not grouped, follow the below steps: 
  1. Click the Size mark card.
  2. Select Fixed so that Tableau Desktop automatically adjusts the size to minimum and the maximum default data. 
  3. (Optional step) Right-click the x axis and unselect "Show Header" if you do not want to display the Quarters. Or, right-click the axis and select Edit Axis... > Remove the title.
To view the steps showed in the below video, please expand the above section.
Note: the video has no sound.
 
CLICK TO EXPAND STEPS

Example 5: Dual Axis & Stacked

Step 1: Build the view: 
  1. Drag Month(Order Date) to Columns
  2. Drag Sum(Discount) to Rows
  3. Drag Sum(Sales) to Rows.
  4. Right-click Sum(Sales) and select Dual Axis.
  5. Drag Measure Names to Columns.
  6. Under Marks > All select Bar.
Step 2: Add colors 
  1. Select Marks > Sum(Discount). 
  2. Place Region on Color.
  3. Select Marks > (Sum(Sales).
  4. Place Product Sub-Category on Color.
To view the steps showed in the below video, please expand the above section.
Note: the video has no sound.
 
CLICK TO EXPAND STEPS

Additional Example: Side-by-side chart combined with a continuous line chart

The ability to create a grouped or side-by-side bar chart combined with a continuous line chart is not currently built in Tableau Desktop. To voice your support for the future implementation of such a feature, please vote on the following ideas: 
Did this article resolve the issue?