This document provides a step-by-step guide on how to create a butterfly chart with one axis using Tableau. The guide includes creating calculated fields and adjusting the axis to create an even butterfly chart. Screenshots are provided to aid in the process.

There are two main approaches to creating a butterfly chart. One of them would be creating a dual axis, this method is especially useful when the axis measures are different, for example, currency and count. And another one would be creating a butterfly chart with one axis when the units of measurement are the same or we are dividing one column into two sides by any binary dimension.

The data for this blog was taken from https://www.kaggle.com/datasets/aungpyaeap/supermarket-sales and the structure is presented below. As an exercise, let’s compare how much females and males spend on each category. In order for our total sales to be one axis we need to split the data into negative and positive based on gender dimension. To do that, let’s create two calculated fields with an if statement and make one of them negative. We can do that by simply creating a calculated field with an if statement:

This way if the order is purchased by a male customer, the total would change to negative and if the order was purchased by a female customer, it would remain as a positive value. Please note that if a butterfly chart is to be completed using two different measures, this step is unnecessary. Now we can put product type on rows and one of our new calculated fields in columns. You can add the second calculated field onto the x-axis to create measure values in the columns. The chart should look like this after this step:

To fix this all we need to do is remove Measure Names from rows so the bar chart is not divided. Now that looks like a butterfly chart! However, don’t be deceived. If we look closely, we can see that the axis is not even on two sides and that could create a false representation as the maximum for the right side is 35k and only 30k on the left. How do we create an even butterfly chart?

Find the maximum value on each side. To do that we have to take WINDOW_MAX of both measure values and compare them in a new table calculation called Max and Min. This will take the window maximum of the right side of the bottlefly chart and please note that for the left side we have to turn that value negative.

Drop both calculation onto details and then ensure that the calculation is done table down by choosing edit calculated field. Next right click on the x-axis and chose to add reference line. Add reference line for the right side of the table. To format the left side of the table click on format the measure values and remove a “-” after a semicolon.

With these steps, you should be able to create a butterfly chart with one axis using Tableau.

If you run into any issues, Tableau has extensive documentation and a helpful user community to assist you.

Veronika Varaksina
Author: Veronika Varaksina

Meet Veronika, a dynamic and adaptable individual with a diverse background in economics, accounting, finance, and data analytics. Veronika pursued a Bachelor’s degree in Economics and gained valuable experience in financial analysis, budgeting, and forecasting while working for five years in accounting and finance. However, she soon realized her passion for data analytics and decided to pursue a postgraduate degree in Analytics at Victoria University. Throughout her academic journey, Veronika honed her skills in data visualization, statistical modeling, and machine learning. Her expertise earned her a spot in the highly competitive Data School program, where she further continues to expand her skills in data analysis.