Let's start with a little riddle.
Let's see how much the Brits love their tea
What do you think is the percentage of Brits who drink tea regularly?
And now, have you gotten the same answer with the same accuracy, speed, and confidence level?
Why is it more challenging to get an accurate answer from pie/donut charts and why do we feel less confident trying to read them?
The main reason is the difficulty in calculating the areas of the pie slices/lengths of the donut arcs.
This is much more challenging and less confident than comparing the areas of rectangular shapes.
For those who want to delve deeper, I've also included a link to a very interesting study:
https://eagereyes.org/blog/2016/a-reanalysis-of-a-study-about-square-pie-charts-from-2009?fbclid=IwA...
A well-designed waffle chart with the necessary supporting elements allows for quick and accurate estimation, eliminating the need to calculate areas.
Unfortunately, the waffle charts in our arsenal do not achieve the same results as the one shown in the image above.
So, what can we do?
We'll use the magic of the matrix in combination with some DAX and conditional formatting.
How will it work?
1. We'll create a 10 x 10 table using DAX.
Waffle table =
Var X_table =
SELECTCOLUMNS(GENERATESERIES(1,10), "X_axis",[Value])// Creating of X axis
Var Y_table =
SELECTCOLUMNS(GENERATESERIES(1,10), "Y_axis",[Value])//Creating of Y axis
Return
GENERATE(X_table,Y_table)
![](https://static.wixstatic.com/media/8fa98a_9c6194b8235847da81ff31717862494b~mv2.jpg/v1/fill/w_704,h_308,al_c,q_80,enc_auto/8fa98a_9c6194b8235847da81ff31717862494b~mv2.jpg)
2. In this step, we create a measure that divides our percentage measure (percent_tea, in my case) into tens and units in the first stage.
In the second stage, it scans the matrix we created earlier and fills each selected cell with 1 if the value is greater than 0, and with 0 if there is no value.
Tea % =
var Pct = [percent_tea]
var PctProcesed = ROUNDDOWN(Pct/10,0)// tens
var SpillOver = ROUND((Pct/10-PctProcesed)*10,0)//units
Return
If (SELECTEDVALUE('Waffle table'[y_axis])<=PctProcesed,
1,
if(SELECTEDVALUE('Waffle table'[y_axis]) =PctProcesed+1 && SELECTEDVALUE('Waffle table'[X_axis])<=SpillOver,
"1",
"0"
))
![](https://static.wixstatic.com/media/8fa98a_cebd716db883488e9b158caf5bef3e01~mv2.png/v1/fill/w_941,h_368,al_c,q_85,enc_auto/8fa98a_cebd716db883488e9b158caf5bef3e01~mv2.png)
3. Now we have come to the point where we only have design work left:
a. We will create a matrix, and choose the design type: None + switch off the totals
![](https://static.wixstatic.com/media/8fa98a_3bb3a58ae9d34e2a816ed8b2ab6fcab6~mv2.png/v1/fill/w_980,h_467,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/8fa98a_3bb3a58ae9d34e2a816ed8b2ab6fcab6~mv2.png)
![](https://static.wixstatic.com/media/8fa98a_33b93a039a224cc0b88050678c5e01e5~mv2.png/v1/fill/w_980,h_529,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/8fa98a_33b93a039a224cc0b88050678c5e01e5~mv2.png)
b. We will define conditional formatting for the background of the cells:
A cell with a value of 1 will receive a highlighted color.
A cell with a value of 0 will receive gray.
![](https://static.wixstatic.com/media/8fa98a_4e671ce111a84be0a664aa8474c4519e~mv2.jpg/v1/fill/w_980,h_354,al_c,q_80,usm_0.66_1.00_0.01,enc_auto/8fa98a_4e671ce111a84be0a664aa8474c4519e~mv2.jpg)
To Hide the numbers we'll apply the same steps for the fonts :
![](https://static.wixstatic.com/media/8fa98a_d7bac80478354460a7685ecfbd9dc6bb~mv2.png/v1/fill/w_980,h_380,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/8fa98a_d7bac80478354460a7685ecfbd9dc6bb~mv2.png)
c. To hide the row and column headers, we will set their color to white.
![](https://static.wixstatic.com/media/8fa98a_9a04f279197b4f4d9001d96db93b0d87~mv2.png/v1/fill/w_980,h_647,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/8fa98a_9a04f279197b4f4d9001d96db93b0d87~mv2.png)
d. To add separation between the waffle squares, we will use matrix gridlines and color them white.
![](https://static.wixstatic.com/media/8fa98a_076a344ff12947be89167b84217d26d6~mv2.png/v1/fill/w_980,h_654,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/8fa98a_076a344ff12947be89167b84217d26d6~mv2.png)
e. To help users read the chart without counting the squares, we will add labels using text boxes.
I have added labels for the beginning, middle, and end. It is possible to add more labels, for example every 10%.
We are left with the title, which also serves as the legend.
![](https://static.wixstatic.com/media/8fa98a_6dac7161fbe145779778b7c2f2652944~mv2.png/v1/fill/w_980,h_344,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/8fa98a_6dac7161fbe145779778b7c2f2652944~mv2.png)
f. Since there is no option to format part of the title of a generic visualization in different colors, we will use a text box here as well.
![](https://static.wixstatic.com/media/8fa98a_61851e3c48ea4f24af5f07d15f692a0b~mv2.png/v1/fill/w_980,h_111,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/8fa98a_61851e3c48ea4f24af5f07d15f692a0b~mv2.png)
And finally, all that's left is to group the entire construction, so it stays in place.
![](https://static.wixstatic.com/media/8fa98a_bae42385ac5c47ea92d2c018e94e31b4~mv2.png/v1/fill/w_837,h_459,al_c,q_90,enc_auto/8fa98a_bae42385ac5c47ea92d2c018e94e31b4~mv2.png)
Thank you to everyone who made it through the read. Good luck with the implementation!
Link to pbix:
Comments