KNOWLEDGE BASE

Creation of a Grouped Bar Chart


Published: 15 Mar 2017
Last Modified Date: 15 Mar 2017

Question

How to create grouped bar charts.

Environment

Tableau Desktop

Answer

To create a grouped bar 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.

The following examples will demonstrate the steps in action using the Coffee Chain sample data source. 

Example 1: Using 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.

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.

Did this article resolve the issue?