Grouped Bar Visuals

While bar charts show comparisons among categories, grouped bar charts show clustered groups of related bars.

The following steps demonstrate how to create a new grouped bar visual representation on dataset World Life Expectancy [data source samples.world_life_expectancy].

  1. Start a new visual based on dataset World Life Expectancy [data source samples.world_life_expectancy]; see Creating Visuals.
  2. In the visuals menu, find and click grouped bars (row 2, column 1).

    selecting grouped bar chart type
  3. Note that the shelves of the visual changed. They are now X Axis, Y Axis, Colors, Tooltips, and Filters.

    The mandatory shelves are X Axis and Y Axis. Note also that the fields placed on these two shelves may be easily swapped by switching X and Y.

    shelves of grouped bars visual type
  4. Populate the shelves from the available fields (Dimensions, Measures, and so on) in the Data menu.

    • Under Dimensions, select country and drag it over X shelf on the main part of the screen. Drop to add it to the shelf.
    • Under Measures, select life_expectancy and drag it over Y shelf on the main part of the screen. Drop to add it to the shelf.

      Note that the field appears as sum(life_expectancy).

      This is necessary because the grouped bars chart type uses aggregated measurements.

  5. Change the aggregate of the life_expectancy field from sum(life_expectancy) to avg(life_expectancy):

    • On the shelf of the visual, click the icon to the right of the field.

    • In the Column Properties menu, click the icon next to Aggregates.

    • From the list of aggregate functions, select Average.

      changing the aggregation to average
    • Click icon at the top of the Column Properties menu to close it.

    • Note that the shelf now contains the modified field with avg() aggregation function.

  6. Click Refresh Visual.

    The grouped bars graph appears.

    Notice that it is very long, as each country reports data for many years.

  7. [Optional] On the Tooltips shelf, add several fields from Dimensions and Measures.

    This enables you to see specific descriptive information in your visuals, such as input values, segment affiliation, and calculations.

    For example,

    • From Measures, drag gdp_per_capita onto the Tooltips shelf.
    • From Dimensions, drag un_subregion, and un_region onto the Tooltips shelf.
    • For all items on the Tooltips shelf, click the icon (down arrow), select Aggregates, and then select Remove Aggregate.
    • For all numeric items on the Y shelf and the Tooltips shelf, click the icon (down arrow), select Display Format, and enter ,.2f.

      Note that these fields are typically from the Measures menu, and in this example include gdp_per_capita and life_expectancy.

  8. On the Filters shelf, add several Dimensions and Measures from the Data menu.

    This enables you to dynamically control the data input, and discover the data at a more granular level.

    For example, from Dimensions, drag country, un_subregion, and un_region onto the Filters shelf.

    From Measures, drag year onto the Filters shelf.

  9. On the Filters self, on the year field, click the icon (down arrow), and select Pick values from a list.
  10. In the Pick values for a year modal window, select a small number of years.

    In this example, we selected 1980, 1990, 2000, and 2010.

  11. Alias the country field as Country:

    • On the shelf of the visual, click the icon to the right of the field.

    • In the Field Properties menu, click the icon next to Alias.

    • In the text box below Alias, enter the alias name of column, as it should appear in the visual.

    • Click icon at the top of the Field Properties menu to close it.

    • Note that the shelf now shows the column with its alias name.

  12. Alias the life_expectancy field as Life Expectancy:

    • On the shelf of the visual, click the icon to the right of the field.

    • In the Field Properties menu, click the icon next to Alias.

    • In the text box below Alias, enter the alias name of column, as it should appear in the visual.

    • Click icon at the top of the Field Properties menu to close it.

    • Note that the shelf now shows the column with its alias name.

  13. Click Refresh Visual.

    The revised grouped bars graph appears.

    Notice that it shows only the years specified on the Filters shelf.

  14. Click Save.
  15. Click (pencil icon) next to the title of the visualization to edit it, and enter the new name.

  16. Change the title to World Population - Grouped Bars.
  17. At the top left corner of the Visual Designer, click Save.