Another great #MakeoverMonday this week, with the source data shown in week 34 on Andy Kriebel‘s blog:

http://www.vizwiz.com/p/makeover-monday-challenges.html

To aid my Tableau development, I learn not only from the process of constructing my own #MakeoverMonday viz each week, but also from deconstructing other submissions. This week’s subject matter was so powerful that it resulted in a number of excellent visualisations. I’ll use this post to start to summarise why I downloaded several of them and how to achieve the element from each that I was interested in. This focuses just on the first three viz’s, as I got stumped by RANK functions…..

Lesson One: Pooja Gandhi – “Call-outs”

One half of the Data Duo, and Pooja’s designs always seem to hit the mark. This week, she conjured this up. There are so many great things to learn from it, but I won’t dive in and try to absorb it all at once as my brain won’t be happy with that. Instead, I’m focusing just on the “call-outs”, as I don’t implement these well. What is a “call-out”? It’s what I call all the floating (and tiled) text boxes and banners that add to the story Pooja presents.

This is so easy! As usual, I tend to get bogged down in assuming that everything in Tableau has to be complicated. I always assumed that call-outs had to be driven by separate worksheets laden down with calculated fields and clever uses of titles incorporating Measures and sneaky tricks etc.

Erm, no.

On Pooja’s viz, every single banner or call-out is simply a well formatted text box:

Screen Shot 2016-08-23 at 20.16.40

Screen Shot 2016-08-23 at 20.17.47

Lesson one learning: Don’t assume everything is difficult! These call-outs and narratives add so much to the viz as a whole, but they are “free”; quick wins than can add a nice layer of context and gloss. Use them!

As Pooja herself comments at the foot of this page, there are times when dynamic call-outs are the best solution, and those will need dedicated sheets in order to incorporate relevant Dimension and Measures dynamically.

Lesson Two: David Pires – Interactive buttons

Another Tableau Ambassador who is a helpful and supportive presence in the community. With this viz, I specifically want to look at the “buttons” on top of the dashboard that act as filters for a number of the other charts. Interactivity is a powerful tool, and it’s nice to see something that isn’t a standard filter or parameter driving the interactivity. How was it constructed?

After unhiding the hidden sheets, I navigated to the Buttons tab and saw this structure:

Screen Shot 2016-08-23 at 20.49.21

The filter on Deaths just sets the start SUM(Deaths) to at least 1. The important Pill is Country Bands on Columns, which is calculated thus:

Screen Shot 2016-08-23 at 20.50.59

So David has just created five bins of varying sizes, in order to allocate countries to bands based on the number of malaria deaths to have occurred. Setting the chart type to square gives a background which can be labeled and coloured with the Country Bands calculated field, and the whole package can be set to Fit Entire View when used as an object in the dashboard:

Screen Shot 2016-08-23 at 21.11.54

The final step is just to configure the Dashboard Actions as you want, which in David’s case was:

Screen Shot 2016-08-23 at 21.12.54

Lesson two learning: It’s easy to tart up the interactive elements of a dashboard by using basic calculations or existing Dimensions to categorise data as you wish. You could easily replicate this concept with Superstore Sales data by adding buttons for Region, or Category as examples.

Lesson Three: Andy Kriebel – RANK_DENSE calculation – or not?!

When I saw Andy’s viz, I liked the look of it, but I couldn’t immediately tell what the final chart was showing. When I found the relevant sheet, I soon “got” what the chart depicted (it’s a dot for each country in that year where the total number of deaths from malaria is 1,000 or more). The clever bit was that the dots are in ascending order, with the country most affected by malaria farthest from the x-axis:

Screen Shot 2016-08-23 at 21.32.57

(Note also that Andy’s title was all manually entered, and not the product of a cunning combination of calculations etc.). So how did Andy get these countries to sort like this? I assumed it was just the use of the RANK table calculation. When I tried it, I got this:

Screen Shot 2016-08-23 at 22.51.50

To get this, I filtered Deaths to only include Deaths At Least 1,000. Also on the filters shelf is Set 1, which is just all African countries. I added a basic calculation to columns to strip the rightmost 2 characters from the Year field, and added a simple table calculation to rows:

Screen Shot 2016-08-23 at 21.43.23

And when you look at my chart, it’s kind of working. Kenya in 2000 is showing the same total as Andy’s chart, but the difference is the way in which the countries are aligned. Andy somehow has the lowest ranked countries tight to the x-axis, with the ascending rank seeing the highest ranked at the foot of the Year. It’s the opposite of mine.

Simple to fix. I just tweak the table calculation to rank in Ascending order, and then reverse the axis to get this:

Screen Shot 2016-08-23 at 21.51.49

So what’s the deal with RANK_DENSE? I didn’t need it when blundering my way to the solution. Or did I? Look at 2010:

Screen Shot 2016-08-23 at 21.56.54

Why is there a blank space? The Ivory Coast ranks 1 with 1,023 malaria deaths in 2010, and South Sudan ranks 2 with 1,053 deaths. Doesn’t it? Let’s drag the table calc to labels and see what’s going on:

Screen Shot 2016-08-23 at 22.00.58

Two things stand out. Firstly, the first circle doesn’t get labeled, even though it is the first country with >=1,000 malaria deaths. That confuses me, but I’ll park that for now. The important things is that for some reason South Sudan isn’t allocated “2” in spite of appearing to be next in line to be ranked. Let’s look at the table calc options again:

Screen Shot 2016-08-23 at 22.06.34

I don’t know what these four variations are. Time to research. Step in Alexander Mou:

http://vizdiff.blogspot.co.uk/2014/08/revisit-of-rank-functions-in-tableau.html

And Jonathan Drummey:

http://drawingwithnumbers.artisart.org/at-the-level-unlocking-the-mystery-part-2-rank-functions-in-tableau/#more-2981

And Tableau online help:

http://onlinehelp.tableau.com/current/pro/desktop/en-us/functions_functions_tablecalculation.html

Aha! So the competition rank has skipped a number as two countries must have equal numbers of deaths in 2010.

I need to read all of these linked articles again, but after a first skim read my feeling was that I wanted to use the RANK_UNIQUE function. To see what was going on, I built a table using RANK_UNIQUE and RANK_DENSE in ascending order on Country, and I also dragged in the SUM(Deaths) calc and made them all discrete to fit them in the table below. All of this was for 2010 as that was the year causing me trouble:

Screen Shot 2016-08-23 at 22.32.50

By my reckoning, RANK_UNIQUE includes an additional country as it includes both Sudan and The Ivory Coast, whereas RANK_DENSE only includes The Ivory Coast. I imagine that’s because Cote D’Ivoire starts with a “C” and that’s before Sudan’s “S”, and alphabetical order takes precedence.

Just to double check, I plotted a 2010 chart for these two countries:

Screen Shot 2016-08-23 at 22.38.44

Lesson three learning: ranks can be hard to get your head round. So much so that creating a data table seems like an effective way to get some understanding of what is going on. Always be inquisitive and try to understand why something is done. I couldn’t see why RANK_DENSE was used here, and my investigating made me more comfortable with the use of RANK_UNIQUE in this instance.

Advertisements