Workout Wednesday: Week 6

For once, I got through a #WorkoutWednesday challenge without too many mental or physical scars. However, there was still a lot I took away from the exercise, so here’s a quick overview of those learnings:

Data Preparation

The data needed to be unioned, pivoted and tidied up. Unioning in Tableau is simple. I just highlighted the Male and Female tables and dragged them into the blank window:

Once in situ, I enabled the Data Interpreter to sort out the headers:

This slideshow requires JavaScript.

Next, I just pivoted the Year columns to make the short / wide format long / tall instead, hid / renamed a few fields, and applied the data source filters required:

Referring to Emma‘s original, I could see that the standard trellis-type calcs could be reused:

So the first real challenge was working out how to plot the data. I started with table calcs and putting Gender on Detail, but that was a false dawn. Ultimately, I needed to calculate the Male and Female Population Estimates, calculate those as a percentage of total, and then find a way to figure out the national average for each Gender. It’s pretty straightforward stuff. The Male calculations are below:

If I plotted that on the view, I got this:

But I knew that I wanted the Male values to head right-to-left, and the Female values to head in the opposite direction. I experimented with shoving a “-” in front of the calcs, but there is a much more obvious solution. Right-click the x-axis > Edit Axis > tick “Reversed”:

I could then put the Female equivalent on the canvas:

That image is with the [Male] calc prefixed with a “-“. This isn’t what I needed to do, as it meant that I couldn’t plot the National Averages as continuous lines to give these values context. The closest I could get was a Gantt effect using cell level Reference Lines, but that wasn’t what was required:

What was needed, was a dual-axis of bar and line for the Male measures, alongside the same for the Female measures. Before progressing, I needed to figure out a way to get the national averages per gender:

This gives the National Average by Year, Age Group and Gender.

Whereas the above calc computes the Male National Average. To determine the percentage:

As I often do, I checked the calculations out in a tabular format in Tableau:

And sense-checked things in Excel:

Cool. Once I was comfortable, I could plot things accordingly, with the Row and Column Dividers simply computing by Year:

But it looked a bit dull. I’d already grouped the age groups into decades to avoid the cluttered look of the original, and I’d see that Andy Kriebel had used colour to highlight where measures were above or below the national average, so I nicked his idea:

Sticking that on the Colour card for bars (and the equivalent calc for the Female dual-axis), allowed me to better highlight Age Groups where the Gender was above or below the national average: