Butterfly charts can be a great way to compare two points of interest that share an axis side by side. Visually this can make the relationship (or lack there of) very easy to see. In this blog I will walk you through how to build a butterfly chart in Tableau. There are a couple prerequisites for this sort of visualisation to work. If you’re comparing a single measure then you’ll need to ensure the scale of the x-axis is the same for both (more on this later). If you’re comparing different measures then they’ll need to both be positive or it won’t look aesthetically like a butterfly chart.
In my examples I’ve used mock data so they look very symmetrical, this may not necessarily be the case most of the time.
Step by Step Guide
In my first example I look at total sales by gender and age; age will be the shared axis and gender will have to be split into male and female in order to look at a comparison between the two. Currently sales is a single measure where I won’t be able to visualise gender side by side with the x-axis going in different directions to create the ‘butterfly’ effect I’m looking for. You can see what the chart looks like below if I don’t apply the next step.
This obviously isn’t what we’re looking for. In order to have a diverging x-axis I need to create a calculation that separates sales for males and females. This is a simple process and will look like this:
Now I can drag my Age dimension into the Rows and my new calculations side by side in the Columns, like this:
You can now right click on the axis you want to run in the opposite direction (this will be the left charts x-axis) and check the “Reversed” box in the Scale section. You should also change the range here (by checking “Fixed” in the Range section) to match the range of the other chart so that your data isn’t misleading. I haven’t applied this step as my charts already match because I created the data for the purpose of this blog.
You should now have a chart that looks something like this:
If you want to create a butterfly chart with different measures, such as profit and sales, then you can follow the same steps. However, you won’t need to change the range of the axes or create calculations to split a dimension.Such a chart may look something like this:
Butterfly Charts in a Nutshell
So there you go! It’s as easy as the above to create a simple butterfly chart. As I mentioned at the start of the blog; this can be a great way to show the relationship between two points of interest. In this example I have used age along the y axis, however, it can also be great to rank and order measures then compare them to identify relationships.