Tableau charts: Waffle chart
Updated: May 17, 2021
Waffle chart just like the pie chart and doughnut chart display parts to whole. This chart is basically a square divided into a grid of 10 x 10. Each grid box representing 1% of the whole 100% piece. The number of grid boxes that are colored or shaded is determined by the associated metrics e.g. sales growth, population growth or any other metric you can think of.
So, how do we create this waffle chart in Tableau?
The first step to creating a waffle chart is creating a data structure to help us map the grids.
Prepare Data Structure
The goal of creating this data structure is to help us plot the 10 x 10 square grids each grid representing 1%. To help us achieve this, we’ll create an excel template having data in the three columns shown in the snap shot below.
Note: You can populate the same data in your own excel sheet or download a copy of the same data here to follow along.
Open the excel sheet in Tableau
Once connected to the excel sheet in the link above;
Convert the measure fields ‘Columns’ and ‘Rows’ to dimension fields, by dragging them from the measure area to the dimension area.
Drag now dimension fields ‘Rows’ and ‘Columns’ to the Rows and Columns shelf's respectively.
Drag the measure field ‘Percent’ to the label shelf.
Order the labels
The next step is ordering the labels so as to have 1% (.01) start on the bottom left corner and 100% (1.0) at the top right corner. To achieve this, sort ‘Rows’ in descending order.
Format the label to Percent
Format the labels to percent by > Right clicking on SUM(Percent) > select Format > under Pane > choose Numbers > Percentage > minimize decimal places to zero.
Executing this we’ve;
Add color to enable comparison by adding metric of interest
At this stage, you can connect to your data set of interest to build calculations for comparison against the percent values of the waffle chart.
However, for this case, instead of connecting to a new data source, I will create the metric for comparison using the calculated field below.
This calculation helps create 51% as a metric for comparison in this case.
Create a Boolean field using the calculation below;
Drag the calculated field ‘Color Field’ to the color shelf.
Change the view into a grid Squares
Under marks card, select ‘Square’.
Remove SUM(Percent) from the label shelf.
Resize the viz.
Hide the ‘Columns’ and ‘Rows’ headers.
Adjust the size of the grids under Size shelf.
Note: Assuming you had connected to a different data set to enable comparison, all you will need to do is to use filters to change your level of analysis. However, for this demo which is based on a static calculated field, I will have to create every metric of interest manually which is tedious.
(Advisable to load comparison data instead of manually imputing metrics of interest)
Annotate the view
Let’s add annotation to make our viz more legible. Right click on any point within the view > under annotate select > Mark.
On the box, delete all except ‘SUM(Metric of Interest)’
(If for your case this aggregation is not there, you'll need to drag it from the measure field to the detail shelf)
Similarly, you can create other views using different metrics in the same way and combine them on a dashboard to create your story.
I hope this article was helpful to you. To receive more of the Tableau tips and tricks, kindly join our mailing list by subscribing below.
Thank you for reading.