Your web browser is out of date. Update your browser for more security, speed and the best experience on this site.

Update your browser
CapTech Home Page

Blog | November 6, 2018

Designing Sunburst Charts in Tableau

In this final part of our Tableau chart design series we will look at the Sunburst Charts discussed in Part I

Sunburst charts are a complex chart type using several advanced techniques like data densification, nested table calculations combined with math concepts like quadratic equations. The foundation for this chart type has been laid by the amazing Bora Beran, and it includes advanced table calculations using mathematical equations. Finally, this solution also incorporates the color gradient enhancement discussed on

Just like our previous two chart types, a Sunburst chart requires some data structuring prior to designing the viz in Tableau.

Step 1

Ensure that your data is structured in the following format before proceeding: Hierarchical data laid out in different columns, followed by the measure and a 'Level' column. The Level column is calculated so that a row of lowest hierarchy is at 4 (because we have four dimensions) and the highest would be 1.

Step 2

Open this Excel file in Tableau using the legacy connection method discussed in Part II.

Step 3

Go to Tools and select 'Convert to Custom SQL Query.' Add a union clause with a 'Pad' field of 1 for the first union clause, and then 203 for the second union clause.

Step 4

Create a bin field using the 'Pad' measure just added in the union clause above. Name this new field 'Padding,' and set the size of the bins to 1.

Step 5

Create the following calculated fields (high five to Bora Beran for coming up with these!).

Index: INDEX()

Edges: IF [MaxLevel] > LOOKUP([MaxLevel],-1) THEN PREVIOUS_VALUE(0)

ELSEIF [MaxLevel] <= LOOKUP([MaxLevel],-1) THEN PREVIOUS_VALUE(0) + LOOKUP([SliceSize],-1)


MaxLevel: WINDOW_MAX(MAX([Level]))

MaxSales: WINDOW_MAX(MAX([Sales]))

SliceLevel: WINDOW_MAX(MAX([Level]))

SliceSize: [MaxSales]/WINDOW_SUM(IIF([MaxLevel]=1,[MaxSales]/203,0))

X: IF([Index]<>WINDOW_MAX([Index]) AND [Index]>=(WINDOW_MAX([Index])+1)/2)



* COS(WINDOW_MAX(2*PI())*[Edges]+


ELSEIF([Index]=WINDOW_MAX([Index]) OR [Index]<(WINDOW_MAX([Index])+1)/2)


([SliceLevel] + 5)

* COS(WINDOW_MAX(2*PI())*[Edges]+

(((IIF([Index]=WINDOW_MAX([Index]), 1,[Index])-1)*WINDOW_MAX(2*PI())*[SliceSize]/((((WINDOW_MAX([Index])-1)/2)-1)))))


Y: IF([Index]<>WINDOW_MAX([Index]) AND [Index]>=(WINDOW_MAX([Index])+1)/2)



* SIN(WINDOW_MAX(2*PI())*[Edges]+


ELSEIF([Index]=WINDOW_MAX([Index]) OR [Index]<(WINDOW_MAX([Index])+1)/2)


([SliceLevel] + 5)

* SIN(WINDOW_MAX(2*PI())*[Edges]+

(((IIF([Index]=WINDOW_MAX([Index]), 1,[Index])-1)*WINDOW_MAX(2*PI())*[SliceSize]/(((WINDOW_MAX([Index])-1)/2)-1))))


Step 6

Drag the fields in the hierarchy to the details shelf on the marks card. Start with the highest level to the lowest level (in this case Region is the highest level and Product is the lowest).

Step 7

Drag the X and Y coordinates to the columns and row shelves respectively. Also add padding to the path shelf on the marks card. Note to change the mark type to Polygon.

Step 8

Right click on 'X' and select edit table calculation. Here we are using nested table calculations. Select all dimensions, keeping the same order as on the Marks shelf (numbered 1-4).

Follow similar steps for other nested calculations, referring to the screenshots below for specific dimension selections.







Step 9

Follow the same steps as above for the Y coordinate, editing each nested table calculation similar to the X coordinate. Once you complete the steps for the Y co-ordinate, you will get a graph that resembles the following. Note that I have cleaned up the formatting to remove all grid lines and zero lines.

Step 10

Switch the dimensions in your hierarchy to colors to get a colored sunburst chart. Clean up the tool tips to hide the unnecessary calculations.

Step 11

Create a color legend chart to highlight different regions.

Step 12

Create a dashboard, then add the sunburst chart and the color legend sheet.