The demographic pyramid is a graph that allows you to visualize the distribution of a population by age and sex. In this tutorial, I will guide you, step by step, to create a demographic pyramid in Tableau Desktop.
Required Data
1 demographic data table,
1 measure, for example Population,
2 dimensions, for example Gender and Age (class).
Step 1: Data Preparation
Before you start creating your demographic pyramid, you need to build age classes:
Right click on the field Age in the Data panel,
Select Create , then Classes,
Select size classes 10 for example,
Edit aliases to make it easier to read the data.
Step 2: Decide between populations
To show the male population on the left and the female population on the right side of the demographic pyramid, you will first need to create these two populations. Here's how to do it:
Create a Calculated field called “Female Population”,
Enter the following formula:”IF [Gender] = 'Female' Then 1 Else 0 END”,
Click on OK,
Create a Calculated field called “Male Population”,
Enter the following formula:”IF [Gender] = 'Male' Then 1 Else 0 END”,
Click on OK
Step 3: Creating the demographic pyramid
Add the field Age (class) On the shelf of Lines,
Add fields Male population and Female population In the shelf of Columns,
Right click on the axis Male population and select Change the axis,
Check Reversed.
Step 4: Synchronizing the axes
Right-click on the field axis Male population and select Change the axis,
In the tab Graduation, fix the Major Graduation has intervals of 500 for example,
Repeat for the axis Female population.
Step 5: Customizing the chart
To improve the readability and visual impact of your demographic pyramid, you can customize some elements:
Adjust colors : If the default colors do not suit you, customize them via the tab colour field markers Male population and Female population,
Adjust the size of the bars : Click on the tab Size Landmark named Everything to adjust the thickness of the bars uniformly.
Advice
In a dashboard, colors are a powerful tool for drawing attention to key information. As a result, this type of chart can be difficult to integrate because it requires the use of two distinct colors. This may attract the reader's attention without any particularly crucial data justifying such emphasis.
However, if you choose to use a demographic pyramid chart, be sure to pay attention to the following:
Traditionally, the male population is shown on the left and women on the right.
Use colors that are easily distinguishable, even for people with color blindness. Choose accessible and neutral palettes that do not introduce bias.
A clear and concise title, like “Distribution of the population by age and sex”, is essential for the audience to quickly understand what the pyramid represents.