I have a bit of a reputation for churning out bar charts, and it’s entirely justified. I love them and find them highly effective means of communicating data in a variety of circumstances. For #MakeoverMonday this week I created yet another bar chart, but it didn’t look like the majority I create:

Screen Shot 2018-03-25 at 18.28.22

A bar chart? Yep. The data this week looked at the way in which different age groups in the UK ranked their preferred brand of chocolate bar. In practise, this resulted in quite a few brands which were ranked by one age group, but not by others. I made a decision to only include those brands ranked by all age groups and achieved that with this calculation:

Screen Shot 2018-03-25 at 18.30.32.png

 

 

 

For each Brand, I counted the occurrences of a ranking. I popped this calc on the Filters shelf and set it to only include instances where the SUM of Filter was at least 3 to ensure that I only included Brands ranked across all 3 age groups.

A consequence of this filtering was that I was creating a new form of rank. Technically I’m no longer looking at the top 10 Brands in the UK, so I added the sub-title to reinforce the fact that I was selectively limiting the data. How did I create a new rank to reflect that?

Screen Shot 2018-03-25 at 18.35.55

Good old INDEX(), concatenated to a prefix to create a tidy Rank #X label. All INDEX() is doing is counting along the table to work out the number of columns in the view; it’s a rank.

Let’s look at the overall worksheet structure:

Screen Shot 2018-03-25 at 18.40.51.png

We can see the INDEX() Measure. Why is the original Rank field in the view? If I unhide its Header, you’ll see:

Screen Shot 2018-03-25 at 18.42.41.png

Removing INDEX() and revealing Rank shows the unusual ranking that is a consequence of my Brand filtering. Where is rank 6? What about Rank 8? If I remove the filter you’ll see:

Screen Shot 2018-03-25 at 18.44.44.png

The Bounty bar was only ranked by 65+ year old pollsters (they are wrong – it’s a horrible chocolate). Boosts and Picnics were also only ranked by individual age groups. This is why I filtered the data in the way that I did, and why the new ranking makes some sense in this context. Let’s move on. What’s that Age Band field? It wasn’t in the original data. A simple string calc:

Screen Shot 2018-03-25 at 18.47.09.png

Speed to insight is always my intention, and I felt that the absence of a suffix to explain what the Age Group field showed was a hindrance. By tacking on ‘yrs’, I believe it allows the audience to readily understand what they’re looking at.

Another interesting part of my worksheet is the AVG(1) field on Columns. What’s that all about? I’m simply forcing Tableau to plot something and fill a space. Without it, this happens:

Screen Shot 2018-03-25 at 18.53.47.png

Nothing appears because there is no value to show. By plotting the average of 1 (i.e. 1), then I make Tableau draw a uniform value across each data intersection. Note that I had to fix the axis to run from 0 to 1 to avoid this annoying gap:

Screen Shot 2018-03-25 at 18.55.13.png

That’s pretty much it. A basic chart but not a standard Bar, so I feel like I’m diversifying!

 

Advertisements