A Pareto chart is a chart containing both bars and a line graph, where individual values are represented in the descending order by bars, and the line represents the ascending cumulative total. It is named after Vilfredo Pareto, an Italian engineer, sociologist, economist, political scientist, and philosopher, who formulated what has become known as the Pareto principle.
In Tableau, you can apply the table calculation to sales data for creating a Pareto chart showing the percentage of total sales that is coming from the topmost products and thus identifying the key segments of your customer base, which are important for your business’s success.
The below procedure uses the Sample – Superstore data source.
How to create a bar chart that shows Sales by Sub-Category in descending order:
- Connect to the data source Sample – Superstore.
- Drag Sub-Category from the Data pane to Columns, and then drag Sales to Rows.
- Click on the Sub-Category on Columns and choose Sort.
In the Sort dialog box, perform the following:
- Under Sort order, choose the option Descending.
- Under Sort by, choose the option Field.
- Leave all the other values unchanged, including Sales as the selected field and Sum as the selected aggregation.
- Click on OK to exit the Sort dialog box.
Products are now sorted from the highest sales to lowest sales.
How to add a line chart that shows Sales by Sub-Category:
- Drag Sales from the Data pane to the far right of the view until a dotted line appears.
- Drop Sales to create a dual-axis view.
- Select field SUM(Sales) (2) on the Marks card, and convert the mark type to Line.
Now the view should look like this:
How to add a table calculation to the line chart for showing sales by Sub-Category as a running total and as a percent of total:
- Click the second copy of SUM(Sales) present on Rows and choose the option Add Table Calculation.
- Add a primary table calculation to the SUM(Sales) to present sales as a running total.
Select option Running Total as the Calculation Type.
Do not close the dialog box Table Calculation.
- Add a secondary table calculation for presenting the data as a percent of the total.
Click on the option Add Secondary Calculation and select Percent of Total as the Secondary Calculation Type.
Now the Table Calculation dialog box should look like this:
- Click on the X in the upper-right corner of the Table Calculations dialog box to close.
- Click on Color in the Marks card to change the color of the line.
The result is now a Pareto chart:
Create a Population Pyramid:
A population pyramid, also known as the age structure diagram, shows the distribution of various age groups in a population.
A common distribution used in this type of visualization data is female and male populations by age. For creating a population pyramid using Tableau, first separate the population (measure) into two groups, females and males, and then create the bins for the age you want to represent in the population pyramid.
For instance, suppose you are working with a table from the United States Census Bureau containing population, gender, and age data.
For creating a bin and dividing a measure into two groups.
- Download and open the below workbook.
- Navigate to https://public.tableau.com/workbooks/CreateaPopulationPyramid.twb.
- Open the downloaded workbook.
- Select the option Worksheet > Clear > Sheet.
- Right-click the Age field in the Data pane, and select Create > Bins.
- In the dialog box Create Bins, enter a bin size based on the age groups you are interested in focusing on, and then click OK.
In this instance, the bin size is 10 which means that the age cohorts are defined by an increment of 10 years.
- Drag the bin you have just created to the Rows shelf.
- Select Analysis > Create a Calculated Field, and then perform the following:
- Enter a name for the calculation. For this instance, enter Male Population.
- Enter a formula similar to the following for isolating the male constituent from the population:
IF [Gender] = 1 THEN [ESTBASE2010] END
In the above case, the census data has defined the Gender value for males as “1.” The field “ESTBASE2010” contains estimated population values.
- Similar to step 5, select Analysis > Create a Calculated Field, and then perform the following:
- Enter a name for the calculation. For this instance, enter Female Population.
- Enter a formula similar to the following for isolating the female constituent from the population:
IF [Gender] = 2 THEN [ESTBASE2010] END
In the above case, the census data has defined the Gender value for females as 2. The field ESTBASE2010 contains the estimated population values.
- Drag the calculated fields you have created to the Columns shelf and the Gender field to the Color shelf.
- Right-click on the axis for Male Population, select Edit Axis, select the check box Reversed to reverse the order the values displaying on the axis, and then click on OK.
After you have changed the sort order of the bin, the population pyramid looks like this: