I have found that it’s good to go with your instincts. With #MakeoverMonday this week, for some reason my head said “give small multiples a go”, so I did, and this post will explain how and why I did it.
The dataset for week 41 is available here. Soon after it was issued, Andy Kriebel posted a really nice viz which made use of the Likert scale, which Steve Wexler has expertly detailed here. It’s probably the most effective way of visualising survey data and I’ll definitely make use of the technique at some point, but today I went with the gut feel.
Small multiples have caused me multiple headaches in the not-too-distant past. However, if you don’t seize the bull by the horns then you’re never going to overcome a mental block so I wanted to tackle this.
My idea was simple – I wanted to create a view of the data that allowed comparisons of cities within each country. As an example, if Germany was showing increased levels of satisfaction with the quality of public transport, was that across the board or were some cities lagging behind?
And how could I effectively compare different ends of the spectrum? If Italian dissatisfaction was decreasing, were opinions in Rome mirrored in Naples? I knew what I wanted to do, but not necessarily how to do it:
- Small multiple slopegraphs with one pane per country, and with each city within that country charted
- User selectable parameter to enhance interactivity. I wanted this to be an iterative process for me and for people looking at the dashboard
OK. So I knew the basics of creating a small multiple chart. After the head scratching of that last post about this albatross, I knew the core of the viz was this:
The row and column divider calcs are as per the last post about small multiples. I don’t get how / why they work, but I’ve given up caring. They do work, and that’s what matters. In the image above, I’ve set both to compute using City.
To edit the data to get Year, I just split the Survey Date field twice. In the image above, I’ve used [% Don’t know] as the Measure, but I knew I wanted to create a parameter to enable users to select the Measure in scope. That is something I can do easily, so I set up the following parameter:
And complemented it with this simple calculation:
So if I replace [% Don’t know] with [Selected Measure], the view will update based on the type of Measure selected by the user. Good, ticks that bit off. The fiddly bit was always going to be creating one pane per country, and plotting each city in that country within that same pane. To achieve this, I enlisted the expert help of Ravi from The Information Lab. Ravi came forward when I said I had a plan, but no idea how to execute it. A series of Twitter messages ensued and the desired result was soon found:
It’s not immediately obvious, but the top-left pane shows the two Austrian cities of Vienna and Graz. Next to that are Antwerp, Liege and Brussels in Belgium. The aim of one pane per country is achieved! How was it done? Some clever table calc work:
What does that do then? Well, it’s factoring in Country and City when calculating, and ensuring that the calcs restart each time we move to a new country. That is key in ensuring that we get a separate pane per country. To do this, I had to manually reorder the Specific Dimensions – literally just a case of clicking Country and dragging it above City to force an order of precedence. This was all Ravi’s work, and I’m grateful for his support in realising my instinctive plan!
OK, so we’re heading in the right direction. The viz still needs some clean up and more than anything else, I need to find a way to title each pane so we know which country is being depicted in each little square. That was WAY more complicated than it needed to be, and I dug out one of Andy K’s posts to suss this one out.
If you download the workbook, you find the way in which Andy nails the titles. It’s another case where I feel that Tableau is unnecessarily complicated when trying to achieve what is a pretty simple idea. It takes a few steps:
This Level of Detail calculation is adding 20% on to the highest value of the selected Measure. That’s important, as it will give the title room to breathe above the highest value in the dataset. So if we plot this calc, we know we’re plotting something 20% higher vertically than the maximum value in the dataset. Then another calc is created:
OK. Now we’re getting a bit sketchy. Index is index – it counts stuff. I get that. What’s this Size calc?
Now in my Noddy terms, what the Country Title calc is doing is finding the midpoint horizontally and vertically, and then returning the Country field. I’m probably wrong, but I think that’s the basic premise. So if I put the Title calc on Rows I get the space to breathe, and then if I put Country Title onto that axis as Text and make it dual-axis, then I get a title in the sort of area I want. This is what the structure of the final worksheet looks like:
You’ll notice that the Country Title has the delta symbol on it. That’s because by default the Nested Calculation is on Index. Again, I have no bloody clue what that means, but it works so that’s fine by me.
The only other notable addition is that of a reference line, which I have shaded below to give a general indication of how each city fares relative to the country average. That was simply a case of this:
After clean up, the final submission looked like this. I kind of like it. I think it encourages interactivity and enables you to compare cities within countries easily. I went with my instinct and stuck to my guns for a change, and it was a fun learning experience.