***Spoilers alert! Solution to the challenge this week is in this post!***
I’ve had an enjoyable year of Tableau development, which is largely attributable to community-driven initiatives such as #MakeoverMonday and #WorkoutWednesday. The former gets a lot of plaudits, but I wanted to write this post to thank Andy and Emma for taking the time to run #WorkoutWednesday every week in 2017.
In contrast to the creative freedom afforded in #MakeoverMonday, #WorkoutWednesday gives you a strict set of criteria to adhere to. You need to match the output provided by Andy and Emma each week – same charts, same tooltips, same dashboard size. Everything.
It has really helped me supplement my learning, and I’m amazed by the consistent excellence of Rosario, Donna and Ann who participate most weeks and seem to nail the brief with ease. I have to download the end solution at least 50% of the time, but I’m OK with that because I’m still learning new things every single week.
I’m not sure what the ongoing plans are for #WorkoutWednesday, but if you’re looking to practice more Tableau and take on some challenging tasks, it’s a great repository of 52 opportunities to learn. Challenges are posted on either Andy or Emma’s blog. This week was one where I didn’t need to download the final workbook, and I’ll run through the solution to give readers an idea of the type of tasks they might face.
Here’s the final dashboard:
Fairly simple with two components. A single sheet for the bars, and a separate sheet for the iconography. That apart, the most challenging aspect was the colouring. I’ll cover each of these elements, starting with the bars.
Initially I thought this was resurrecting an earlier challenge set by Andy, but in fact it was a pretty easy thing to do. Rather than use the chocolate dataset, I’ll recreate the challenge using the Sample – Superstore data. Let’s start by breaking down Category, Sub-Category and Sales:
Not looking too clever, is it? I know that I need to break things into columns using Category, that I want to look at the Sum of Sales, but I need to find a way to carve things up into rows based on the value of sales for each Sub-Category. How to do that? Rank them:
Duplicating the SUM(Sales) onto Rows allows me to right-click and create a table calculation. I adjust a few things to make it a RANK_UNIQUE based on Sub-Category. Initially Tableau reverts to plotting things as Circles as both values are Continuous so a scatterplot is plotted. Changing the measure on Rows to Discrete is the answer:
The next step is to create the labelling to identify the Sub-Category within each Category. Dumping Sub-Category on Text and aligning left is not the solution:
Hmm. So how can I create a point on which to anchor a label, and a point where I can adjust the spacing to ensure it fits in front of the bar? Dual-axis.
It took few tweaks, but I’ve basically edited an in-line calc to create the space needed for the Sub-Category names to fit. Note how I’ve set the second axis to Circle. Now it’s a simple case of setting the Colour opacity on that axis to 0% and dropping the Size as low as it will go (plus the usual “clean-up” rigmarole involving gridlines, row and column dividers etc.):
Good. Things are slotting into place. Let’s address the colouration issue now. We want the top Sub-Category in each Category to be one colour, the bottom to be another, and everything else to be a final, third colour. Calculation time:
Looks a bit fiddly, but is more obvious when I reveal the table calc on Rows:
Referring back to the calc. If the rank is 1 then we’ll call the Sub-Category “Top”. If it matches the same value as the maximum within the window, then it’ll be tagged “Bottom”, otherwise it’ll be regarded as “Middle”. Plonk the calc on Colour and nothing happens until you set it to Compute using Sub-Category:
And you can easily validate that things are working as expected. The view is broken up into separate windows with Category on columns, so the table calc for colour runs down each of those windows in isolation. Some colour refinement allows us to finalise this part of the challenge easily enough.
One things I like to do now is add a touch more detail to labelling, which in this instance can be achieved by making the rank of each Sub-Category visible, but in a way that’s more aesthetically pleasing than just revealing the header:
ATTR() gets around the old aggregate / non-aggregate error message. When this is on Text, things look a bit better, in my opinion at least:
Onto the icons. Again, it’s easy but I wouldn’t have known about it a few months back, so it’s worth sharing in case anyone newish to Tableau hasn’t seen this technique in action. I created a new sheet and dragged things around to create this:
I want Category on Columns to achieve the same three column structure as the first sheet. Category is also put on Shape, which means that I can allocate a different Shape to each Category. You can download .jpeg icons and place them into sub-folders in your My Tableau Repository > Shapes folder on your laptop.
My “Furniture” icon is a bit crap, but you get the idea. With this done, it’s just a case of bring the components together on a dashboard.