Learn how to enhance a basic butterfly chart in Tableau by centering labels and refining formatting for a cleaner visual presentation. This article walks through practical steps, including creating calculated fields and customizing chart settings, to build an intermediate version of a butterfly chart.
Key Insights
- Use a calculated field with a value of zero as a placeholder measure to insert centered labels between two green pills (measures) in Tableau, a technique that helps avoid layout constraints in the visualization.
- Change the mark type for the placeholder field to “Text” to display labels properly and adjust formatting options such as font size and grid/zero lines for a cleaner look.
- Noble Desktop's training highlights how to manipulate Tableau's shelves and formatting tools to overcome default chart limitations and strategically design intermediate butterfly charts.
Note: These materials offer prospective students a preview of how our classes are structured. Students enrolled in this course will receive access to the full set of materials, including video lectures, project-based assignments, and instructor feedback.
Butterfly level two. So you're going to start by duplicating level one, because the work that we did for the first butterfly chart can now be duplicated, and we don't have to do everything we just did all over again. So I'm going to right click on butterfly basic, and I'm going to click duplicate.
And when I click duplicate, it duplicates it. And I'm going to go over here and rename this intermediate. Butterfly intermediate.
We want to create something that looks like this. I want to put the labels in the middle. I really don't want to duplicate the labels.
It was okay that it was on the left, but what if I want it on the middle? Then it's available to both of the wings. So this is a version where we're going to put the labels in the middle. This is the intermediate version.
Now to do this, you're going to run into the limitations of working with Tableau when it comes to doing something like this. You're going to have to understand how the measures and dimensions can be organized in the shelves. And the purpose of just even doing something like this is even just understanding how the program works.
Why you can do certain things and why you can't. So before we start, we need to create a calculated field. And so we'll create a calculated field, and we'll call it zero.
I would like to be able to take a label. First of all, let me take out the labels that I have here. Well, here's the label.
I would like to take the label for sum of sales and put it like right in the middle like that. It doesn't work. Can I make this a label? No, it doesn't work.
So I'm going to take this out. I'll go here. Let's see.
Can I take this? This is what I want to put. I want to put the label right here. It doesn't work.
It doesn't like it. No, this is the label. It's right here.
Let me put it right in the middle. It won't let you. It won't let you.
Okay. You cannot put a blue pill in between two green ones. So what you're going to have to do is bring in another green one, but you can't use any of your dimensions.
That's why we need to create a calculated field. So I'm going to go up here. This is where I like to create a calculated field.
I'll choose calculated field from the dropdown, and I'm going to call this zero. You can call it whatever you want. And then I need to enter a value.
I don't care what the value is. The value is a placeholder. So since I called it zero, this reminds me that I need to type zero here.
Apparently, the calculation is valid just by typing zero. And then I'm going to click okay. What happened? Nothing.
There's the field at the bottom. It's in the measure names. But guess what? It's green.
Oh, so it's not blue. So I can drag this in between sum of sales and quantity. Are you sure? Yeah.
Let's try it. Oh, okay. Well, it's unfortunate.
It has that stuff there. And look, it created its own marks card. We moved it between the two measures, and I need to change the type from a bar chart.
It's trying to create a bar chart with a zero value. This is what a bar chart looks like when the value is zero, because that's the numerical amount for this. So I am going to change this to text ABC.
At least it's not trying to create a bar chart. There's not too many opportunities for me to ask you questions, especially when you're looking at the instructions. But maybe you don't have the same instructions that I have.
If I wanted to display the sub products, does anyone have a sense of what I would do next? And there we go. And so now we almost have what we want. This might actually be enough for the second version.
If you want to play around with the text, you say, you know, the text is too small. So just go to the label and edit the label. I'm going to go over here.
Actually, go up here. And let's see. I'm going to click this, and I'm going to increase the size.
And I'll click apply. Oh, much better. It fits better there.
There are a couple of things that you can do to clean this up. So I'm going to go to the access. I don't want the word zero here.
So I'm going to right click here at the bottom and choose edit access. And I'm going to take out zero. I'm going to take out include zero tick marks.
I want none. I want none. I don't want any ticky, ticky marks anywhere.
So I'm going to close this. Okay. It's nice and clean.
I don't have zero at the bottom. You may be unhappy with the line. It looks like there's a line in here.
This drives people crazy if they're a little too OCD. So how do we fix this? Format. I'm going to right click and choose format.
So in this area, the thing that's causing this to show up is related to lines. When I go to format, I'm not interested in formatting the font. Because I was here, it says format font.
No, I'm not interested in font. I have six other buttons I can click here. I want to click on the one that has to do with lines.
And I want to get rid of all these lines. Look, I have lines here. I have lines here.
Maybe I can keep them for columns, but take them out for rows. Or maybe I just want to remove all of them. So I'll go over to rows.
That's none. That's grid lines. I'm going to click here and choose none.
And that took out these lines here. Rows for the sheet, none. Zero lines, none.
Columns, none. And that did it. That was the zero lines.
The lines for zero. And so this is now much cleaner. If I wanted to add labels for this, this represents sales.
I'll click on the sales marks card. I'll close the format bar. I'll take sales, and I'll move it over to label.
Now they're equal. So this is now the butterfly chart. Is there any way you can resize this, bring these closer? And the answer is no.
These are equal size. This is something that automatically happens. You can't control the size here.
So this is as good as it's going to get for the intermediate. We did a good job with this. Let me just check to see if there's anything I missed in my instructions.
We created a new calculated field and we set the value to zero. That's what we did here. Move it between the two measures.
We did that here. Change the calculated field chart type to text. That's appropriate because we're about to move the subcategory to the text label.
Then you want to turn off show header from the subcategory pill. So I could take off show header. I could leave it.
I'm fine with this being here. And it's perfect because I changed the sheet to butterfly intermediate. This is using the sheet name, but it still relates to sales times quantity, but it gets intermediate from the name of the sheet.
Butterfly basic gets butterfly basic from the name of the sheet. I didn't really do that part. All right.
Pick marks set to none for both. I did that. Edit the access for calculated field and remove name.
I did that. In the sheet, you want to set zero line to none and grid lines to none. You may need to do this also for rows and column rows and columns.
And that's a wrap on the intermediate version of the butterfly chart.