Bump Charts

How to make a bump chart in Tableau (with a side of politics)

 

Finished product

 

Recently the Netherlands held their general elections. This was a tense time of year for me, having watched the UK vote to leave the EU and seeing Trump become president. Maybe I’m a bit of a hippie or an idealist, but I am not very much a fan of the current popular xenophobic opinions. Sure, the world is going through some uncertain times, but wouldn’t it be better if we just worked together?

I thought I’d have a look to see how the political climate has changed in The Netherlands over time. The results I found still a little alarming, the, what some may call the “racist” PVV party, has gone up in rankings, but luckily, has not reached the top!

Enough of that, it’s time to viz. So what I wanted to do with my viz, was see how each of the political parties ranked over the years. I got my data from the almighty Wikipedia. They have a page for each election year, showing how many seats each party has won. I copied and pasted these into an excel file. Simples!

Now to make the bump chart:

  1. Bring the measure (or dimensions) you want to splits your ranks by (in my case the year) to columns as a discrete field.
  2. Bring the field containing the members you want to rank to colours. In my case this is the ‘Party’.

steps 1 and 2

  1. To apply the ranking, you will need to create a calculated field for the measure you want to rank. To do this I’ve used the Rank Unique function.

 

Step 3

  1. Bring this new rank field to the rows shelf. This will look a little messy to start with.
  2. You now need to change the ‘Compute Using’ to your dimension of choice, which for me is ‘Party’. In case you aren’t sure how to do this, click on the triangle on the right-hand side of your rank pill and select, compute using, then your field.

step 4

  1. Almost there! To create the “bumps” you will need to make this a dual axis chart and change one of your marks to a circle. Done!

 

step 6

  1. Format etc. to your liking!

See the final viz here!

Blue vs. Green

Understanding How Tableau Thinks: Discrete vs. Continuous Data

5

This week I’m doing my very first Tableau training session. In explaining how Tableau works, or how it thinks, which is important for really leveraging the power of the program, one must understand, the difference between the blue and the green pills. This blog is also taken from my data school days and will be very much like Tom Brown’s blog post, but here goes my interpretation…

When you look at your Tableau Desktop window, you will notice that your data has been split into ‘fields’ and sit in either a ‘dimensions’, ie. what you are measuring, or ‘measures’ ie. the measurement that was made, shelf, in the data pane to the left. These fields are either blue or green and when brought into the chart building view, they are called pills (because they look like pills) and retain their blue or green colour.

The colours actually represent the type of data in the field. The blue pills contain discrete data, and the green pills contain continuous data. The blue discrete field contains a finite number of values, so in the example there are only a finite number of product categories. The green continuous fields contain an infinite number of values ie.  the number of sales could be infinite.  

A field being discrete or continuous, impacts every aspect of functionality in the analysis, from the way the data is displayed, to the behind the scenes processing of the data and understanding how this differs is essential to understanding how Tableau works. I’ll explain these differences below, using the Superstore Sales Sample data that you get with Tableau Desktop. I will use them in columns and rows to build a chart, in filters to streamline data and in colour, to add levels of detail or highlights to your presentation.

  • Columns and rows

3

  • When a discrete field is added to a column or row, it will be displayed as a ‘header’, something that is used to divide your data.
  • If you do the same with a continuous field, an axis is drawn which will give you an aggregation of the field you have selected for the entire data set. For examples, if you are looking at the Superstore Sales example data set, provided by Tableau, and you have put sum of ‘sales’ on the column or row shelf, you will be given the sum of all the sales in the entire data set ie. over x amount of years, for x amount of product types, in one column or row, respectively.
  • Now by using both, you bring in your continuous data, and can start breaking this down by the categories set by the discrete data, for example, breaking down the sum of sales, by the year or (sub)category of items sold.

Pro tip: You can sort your data really easily by pressing the little  button on the axis  you want to sort by.

Knowing this, you can make almost any variation of chart in tableau. Bringing multiple discrete fields into the view, gives you a nested division of the discrete fields. For example if you bring in category and subcategory.

8

Bringing in more than one continuous field, gives multiple axes for the same discrete fields. For example if I bring in both sales and profit for my product category, I will now essentially have to mini graphs.

4

You can make a scatter plot, by plotting two continuous fields against each other, making two axes.

9

Alternatively you can make a table, by placing your discrete fields on the columns and shelves to create headers and placing a continuous field on the details on the marks card to flesh the table out.

15

  • Filters

What happens when you put discrete fields and continuous fields on filters, again, really shows what the difference between discrete and continuous data is.

  • Placing a discrete field on filters will bring up a dialog box, which allows you to choose ‘members’ of the discrete fields.
  • When placing a continuous field on the filter shelf, you first have to give an indication of whether or not you want your data aggregated and if so, how. You are then prompted to select a range from your continuous data.
  • Colour

Once you have created a chart, you can use colour to show another layer of information.

  • A discrete field will essentially put a grouping on by colouring members of that group, or break down a bar into subcategories, depending on what granularity you colour by. In the example, of sales by subcategory, if you bring category to the colours shelf, all subcategories within one category will be given one colour.

10

  • Bringing a continuous field to the colours shelf, will give you a divergent colour scale for that particular field. For example, if you were to bring profit to the same view, you then get the sales bars coloured by a profit scale, with the least profitable in red and the most profitable in green. These colours can of course be changed!

11

Hopefully that has cleared up the distinction between the blue and the green things in Tableau!