top of page
Search
• Bernard K

# Proper way to sort sunburst chart in Tableau

### Introduction

Sunburst chart is used to visualize hierarchical data through a series of rings that are partitioned into different categories. Each level of the hierarchy is represented by one ring – with the inner most ring being the top of the hierarchy.

### Example of sunburst chart

This article specifically focuses on how to properly sort your sunburst chart in Tableau. But before that, let’s look at the problem first.

### The Problem

When you sort fields in the sunburst chart, normally Tableau preserves the sorting order from one category to another. See in the attached view.

(From the above view – and looking at the starred categories, you can see that Technology category is ranked 1st across the different product Segments when indeed it’s not the top performing category for the Consumer segment. The same applies to the product Sub-Category, where the Art Sub-Category is ranked 1st for the Office Supplies Category a scenario that does not hold true for Consumer and Home Office segments).

### The Solution

The proper way to sort fields in the sunburst chart is by first making the categories unique for the levels that have distorted sorting (where sorting order is preserved).

You can make the categories unique by creating combined fields. For this case, I am experiencing the sorting problem at Category and Sub-Category levels (2nd and 3rd ring). To rectify this, I will create two combined fields.

• Category & Segment – (which combines the dimension Category and Segment)

• Category, Segment, Sub-Category – (which combines the three dimensions)

Next, I’ll add these combined fields in the hierarchy field – just before the dimension Category and Sub-Category.

See below.

### To correct the sorting problem at level 2 (2nd ring)

• Drag the hierarchy field to the Detail shelf.

• Drag the measure field (Sales in this case) to the Angle shelf.

• Expand the hierarchy up to Category level.

• Sort the dimensions ‘Segment’ and ‘Category & Segment’ in descending order by a field – (in this case by Sales).

• Change the dimension Category from Detail to Color.

See below.

### To correct the sorting problem at level 3 (3rd ring)

• Drag the hierarchy field to the Detail shelf.

• Drag the measure field (Sales in this case) to the Angle shelf.

• Expand the hierarchy up to Sub-Category level.

• Sort all the dimensions before Sub-Category in descending order by a field – (in this case by Sales).

• Change the dimension Sub-Category from Detail to Color.

See below.

Notice that, by making these few adjustments to the viz – all the dimension members are properly sorted in descending order by Sales at every level.

See below.

### Conclusion

If you like the work we do and would like to work with us, drop us an email on our contacts page and we’ll reach out!