Butterfly Chart in Tableau

While analyzing regional sales performance for our retail business, I wanted to understand how two customer segments, Consumer and Corporate, performed across different sub-categories in terms of total sales.

To compare the sales data for these two segments, I created a Butterfly Chart that displays Consumer sales on one side and Corporate sales on the other side of a central axis, with sub-categories listed in the center.

In this Tableau tutorial, I will explain what a Butterfly Chart is in Tableau and how to create a butterfly chart for data comparison.

What is a Butterfly Chart in Tableau?

In Tableau, a Butterfly chart is used to display and compare two sets of data that share a common axis. In this chart, the data is displayed in horizontal divergent bars on the left and right, and in the centre, we show the dimension for which we are comparing the data. It gets its name because the chart looks like a butterfly, with bars extending in opposite directions from a central axis.

The butterfly makes it easy to analyze and compare the differences between the two groups for each category.

Create a Butterfly Chart in Tableau

In this example, we will create a butterfly chart to compare the sales across different sub-categories for the product segments, consumer, and corporate.

For this tableau butterfly chart, we will use the Tableau Superstore data. Connect the tableau with the data source and follow the steps below to create a butterfly chart.

  1. In the superstore dataset, the segments consumer and corporate are stored in one field, segment. To take the values of these segments separately, we need to create the following calculated fields.
  • Consumer Sales:
IF [Segment] = "Consumer" THEN [Sales] ELSE 0 END
  • Corporate Sales:
IF [Segment] = "Corporate" THEN [Sales] ELSE 0 END
  1. Add the calculated field Consumer Sales and Customer Sales to the Columns, then add the Sub-Category to the Rows.
Create a Butterfly Chart in Tableau

Check out: Create Radial Bar Chart in Tableau

  1. To create a butterfly chart, we need to display the bar on the left side in a divergent way. Optionally, sort the order in decreasing order and right-click on the X-axis of Consumer Sales, then select Edit Axis.
Tableau butterfly chart
  1. In the Edit Axis window, select the checkbox Reversed in the Scale section.
Create Tableau butterfly chart
  1. Now, we will see that the horizontal bars for the Consumer sales are in a divergent format. These left and right side bars represent the wings of a butterfly.

To differentiate the data, we can also change the color or wings. To do this, go to the Marks section and select the Color card for the measure you want to change the color of.

From the color palette, select the color you want to assign.

Add Color to butterfly chart in Tableau

Check out: Build Histogram in Tableau

  1. To make this chart a complete butterfly chart, we need to add the dimension label between the two data sets.

For this, create a field in the rows “AVG(0)” and drag it between Consumer Sales and Corporate Sales. It will make a blank space between the graphs.

How to create a butterfly chart in tableau
  1. Go to the Marks section of the AVG(0), select the Type as Text. After this, add the Sub-Category to the Label card to display sub-categories in the middle of the butterfly chart.
Add dimension in Tableau Butterfly chart

Check out: Side By Side Bar Chart in Tableau

  1. Since we have sub-categories at the centre of the butterfly chart, we can remove sub-category headers from the y-axis. Right-click on the Y-axis and uncheck Show header.
Create a custom Tableau butterfly chart

To compare sales figures for both segments, add the calculated fields Consumer Sales and Corporate Sales to the Label card in their Marks.

Create Butterfly Chart in Tableau

Now, we can view the complete butterfly chart, which allows us to compare the sales of the Consumer and Corporate segments across different product subcategories.

This way, we can create a Butterfly chart in Tableau by following the above steps.

Check out: Create a Map Chart in Tableau

I hope you now understand how to create a Butterfly Chart in Tableau to compare two data segments, like Consumer and Corporate sales. This type of chart is useful when you want to highlight contrasts or show a comparison between two categories across the same dimension.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.