How to Make a Donut Chart in Tableau

By: Eric Parker

Pro Headshot.jpg

Eric Parker lives in Seattle and has been teaching Tableau and Alteryx since 2014. He's helped thousands of students solve their most pressing problems. If you have a question, feel free to reach out to him directly via email.

In the Tableau world, donut charts sometimes get a bad reputation just like pie charts. The reason basically boils down to humans being less adept at comparing angles of a circle than length or a line or bar. That said, I have a soft spot (pun intended) for donut(s) (charts).

 
 

They work best when the measure has a scale with a definite end point and the values can’t be negative.

A few examples:

●        What percent out of 100 did each student receive?

●        What was the average response 0-10?

●        What percent of our goal did we meet? (this one can be a little tricky if the value goes above 100%).

I am going to use Profit Ratio with the Superstore data set for my examples. Profit Ratio is a great field for use in a donut chart because although it can go negative, that’s unlikely and the value can’t exceed 100%.

If you’re trying to build along, this is the Profit Ratio calculation I’ll be using.

 
127-2.png
 

The first thing we need to build is the pie chart that sits in the background of the donut chart. In order to build this I will need one more calculation, “the remainder”. What I mean by that is if Profit Ratio is 70% the remainder if 30%.

Here’s what that calculation looks like.

 
127-3.png
 

Now to build the pie chart. It requires the following steps:

●        Set the Mark type drop-down to Pie.

●        Add the Measure Values field to Angle on the Marks card.

●        Add the Measure Names field to Color on the Marks card.

●        Filter on Measure Names to keep only [Profit Ratio] and [Profit Ratio Remainder] in the worksheet.

127-4.png

I’m going to make a couple other tweaks as well like setting the worksheet fit to Entire View and changing the mark colors.

127-5.png

To layer a smaller circle on top of the donut with the Profit Ratio % on label, we’re going to need to create a dual axis chart.

The first step is to create a calculation which will give us an axis.

 
127-6.png
 

I like to use 0 so I don’t have to mess around with aggregation. The SUM, AVG, MIN and MAX of 0 is always 0.

Next, we can drag the [0 Axis] field to the Rows shelf twice. That gives us two different sections of the Marks card which we can edit independently.

127-7.png

Now you can go to the second section in the Marks card, set the mark type to circle and remove all fields from the Marks card.

127-8.png

You can use the Color tab of the Marks card to change the circle color and then add Profit Ratio to Label and customize the text size and alignment.

127-9.png

Then, you can right-click on the second [0 Axis] field on the Rows shelf and select “Dual Axis” from the drop-down so the circle lays on top of the pie chart.

 
127-10.png
 

You’ll likely need to do some resizing in the Pie and Circle sections of the Marks card to get the look and feel you want.

127-11.png

From that point forward, it’s all formatting. You should hide the [0 Axis] headers (right-click on the axes and deselect “Show Header”) and remove zero line (both done in the formatting window).

127-12.png

If you want to add a dimension to the Rows or columns shelf, that works too.

127-13.png

Interested in taking donut charts even further? Check in next week to learn how you can add a reference line to a donut chart and change the color of the donut based on whether the goal is met.

 
Donut With Line Alternate.PNG
 

Need help building your own visuals? Reach out or book an office hour and we’ll help you get rolling!

How to Add a Reference Line to a Donut Chart

Viewing Data in a Time Zone of Your Choosing (In Tableau)

0