Data Dissection: The Icicle Chart
A few months ago, I was trying to figure out how to create a sunburst chart in Tableau when I came across Ken Flerlage’s blog post on it. Sunburst charts are very pretty but honestly, they are rather hard to create and very fragile if the data isn’t formatted exactly right. But in his post, I came across a link to another blog from Adam McCann where he created an “icicle chart”:
I was really interested in trying to figure out how to create this type of chart so I did what I am compelled to do: I downloaded the workbook and dissected it so that I could recreate this chart. It’s actually surprisingly very simple to create this hierarchical chart where each “level” of data is broken down into its subparts. So how do we make this?
- Download the data and import it into Tableau. I have the example data in a Github gist here for now.
- You need to understand the hierarchy in the data and what groups are under other groups. In this dataset’s case, the Level ID column corresponds to the level of the organization and the ID column is under it. 1 = Department, 2 = Office, 3 = Staff. You can either create a mapping for the Level ID column in a calculation or just alias it like I did.
3. Value to be summed up is in thousands but I just converted it to Salary. Then drag it to Columns to sum it up, drag Level ID to Rows, and ID to Detail in the Marks Shelf because it corresponds to Level ID distinctly.
We’re like 90% of the way done already. Like I said, the icicle chart is surprisingly very easy! We already have most of it other than aesthetics while the subgroups in each level add up to the level above it. You can check that yourself as the data is formatted to add up that way (you may have to ensure that for your own dataset if it doesn’t already do that).
4. There are a few more calculated fields in the original icicle chart. I just copied them over as they are mostly for the tooltips. The only thing I really care to add right now is the color so drag over a Color field based on Level ID. Also, make sure to make the view fill the Entire View.
You can assign colors by going into the Color Marks card and assigning each group to a color palette. Looks like mine inverted the color gradient (the department should probably be the darkest color so that the color “flows” down dark to light) but this is easy enough to invert manually.
5. I still need to fill up the space and add in divisions between bars that went missing after adding color. Increase Size in the Marks card to maximum and add a white border in the Color Marks card.
And voila! We have the icicle chart that Adam created in just a few short steps. What I have in the end is this:
I can certainly clean up the tooltips and office labels but those are just final aesthetic steps. With the data formatted in the correct way, the icicle chart is a great tool to show hierarchical data and what is nested inside of each other (certain offices are under departments and certain staff work within those offices). But it doesn’t work as well when there are a lot more total groups and many lone groups among them.
So remember, always try to fit your data visualizations to your data, not the other way around. Happy dissecting!