MIP Logo

How to create a bikini chart (Population Pyramid) in Tableau

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here. 

Here are the steps to make a bikini chart (or population pyramid) for Age-Sex population. There is an extra section for adding a mark to compare which gender has the higher number in each age bracket.

Steps

  1. Place Age in rows and Female on columns.
  2. Place Male just below the graph as shown in the picture
  3. Move the Measure Names that appears on rows to the color in the marks pane. Both Male and Female should now have bars for each age bracket. Double click the color on the Measure Name box on the right to change the colors.
  4. Right-click Time on the dimensions pane and select Show Filter to show the years. Hover to the top right of the filter box and click the drop-down arrow to change the filter to a single value drop-down list. Remove All from the filter.
  5. In the Measure Values pane below the Marks pane, double click the SUM(Female) and add a negative sign at the beginning so that Female is now on the left. This gives the shape of the graph. Change the view to Entire View to enlarge the bars. 

You’re all done now!

Optional

Creating a mark to show which gender has the higher number in each respective age category

  1. Create a calculated field to make the marks. Drag it to the columns pane.
    • if [Male] > [Female] then -[Male] else [Female] end
  2. In the Comparison Mark pane, change the graph type to Gantt Bar. Remove Measure Name from the pane.
  3.  Right Click the Comparison Mark pill in the columns and select Dual Axis. Synchronize the axis by right clicking the header of the Comparison Mark and selecting it. Right click it again and select Show Header to remove the header. If the graph of the bikini chart changed to circles, change it back to a bar type.
  4.  To make the colors change depending on whether Female or Males have a higher number in the age bracket, create a calculated field. Change the colors to reflect the same colors used for Male/Female.
    • if [Comparison Mark] = -[Male] then 0 else 1 end

Date source: https://population.un.org/wpp/DataQuery/

Share this post