How I Created the Digital Economy & Society Index (DESI) in Tableau – 4 Mini Tutorials

Yes – it’s been a while since I blogged about anything; but figured now would be a good time to get back into the groove and release a long overdue post about how I created my ‘DESI – Digital Economy & Society Index’ dataviz which was recently voted as VOTD & VOTW on Tableau Public. Getting recognition for all the time and effort I put in over the last couple of months learning how to use Tableau and apply dataviz best practises was great, so this is my way of giving back.

Side note: if you want to read more about the design process, learn about some of my other fav tableau tips and tricks and what makes a great Liege waffle; make sure you check out my ‘Tableau Community Spotlight’ interview with Michael Sandberg.

In the tutorials below I used a practice version of my DESI viz as the example. Feel free to download the sample workbook I created so you can reverse engineer the techniques using my edited dataset.

tutorialmap-m@2x.png

Tutorial 1: Parameter ‘Filter’

Let’s start with something simple.

You know when you want to use your parameter as a filter but can’t change the formatting to blend in with the rest of your dashboard? This short tutorial will explain how I worked around that. And I invite you to use the sample workbook in case you want to follow along.

Step 1: Create the Country parameter

Right click on the ‘Country’ dimension > Create > Create Parameter (exclude the EU average)

countryparameter@2x

Step 2: Create the ‘Country Label’ Worksheet

Start from a blank sheet, put the ‘Country’ dimension on Columns and Filters and drag the ‘Country Parameter’ you just created onto the sheet.

countrylabel@2x

Next you’re going to add the parameter to the worksheet title via ‘Insert’.

parameter title@2x

Step 3: Float the parameter and label worksheet onto your dashboard

And this is where the magic happens. By adjusting the W&H and formatting of the containers, you’re going to make them look as one.

combined@2x

For the ‘Country Parameter’, remove the parameter title & change the width of the container until only the drop-down arrow is visible.

adjustparemeter@2x.png

Then float the label worksheet next to the parameter. On the worksheet change the Fit to ‘Entire View’ and adjust W&H of the container to show the country only; and have it line up right next to the dropdown arrow from the parameter.

Took me a while to figure out but it really is as simple as that.

Tutorial 2:  Bar Chart with ‘Dynamic’ Colouring

Next you’re going to create the bar chart and use the ‘Country Parameter’ to highlight a specific country (in yellow) and at the same time show how that country ranked compared to the EU average (in blue).

Step 1: Create a simple Bar Chart

Put the ‘Country’ on Rows, ‘Weighted Score’ on Columns and ‘Year’ on filters (select 2018). Drag the ‘Country Parameter’ onto the worksheet.

barchart@2x.PNG

Step 2: Create the calculation for the colouring of the bars/countries

Creating this calculation will:

  • colour the country selected via the parameter colour 1 (yellow)
  • colour the EU average in colour 2 (blue)
  • and colour all the other bars in a different colour (grey)

calculationcountrycolours

Step 3: Put ‘Country Colours’ on ‘Color’ in the Marks card

Now that you’ve added ‘Country Colours’ to the sheet, try toggling the parameter to a different country and you’ll see the bar that’s coloured yellow shifts while the blue one (EU average) remains in the same position.

colouredbarchart@2x

Step 4: Adding the Country ranking to the tooltip (First Round)

And for some additional detail, you’re going to add the actual ranking number to the tooltips.

First try the the following table calculation.

calculationranking2@2x

If you now select Finland via the ‘Country Parameter’; the 3rd bar from the left will colour yellow but if you then validate the tooltip you’ll notice it will rank Finland as #1 which is not correct.

Next you could adjust the table calculation as shown below but that will only solve part of the problem. Finland will be ranked correctly as #3. However with the EU Average being one of the ‘Country’ values, it will be ranked as #15 and Slovenia as #16, while the EU should rank as 0 and Slovenia as #15.

calculationranking2edit@2x.PNG

Step 5: Adding the Country ranking to the tooltip (Second Round)

Let’s try something else. Why don’t you give the following calculation a try. What it’ll do is:

  • for all the countries ‘before’ the EU Average (so where the total score is greater than the average) … they will be ranked using the calculation from Step 4
  • the EU Average will be ranked as 0
  • and all the countries after the EU average will receive an ‘adjusted’ ranking

adjustedcalculationranking@2x

Before testing, make sure you adjust the table calculation as shown below.

adjustedcalculationrankingedit@2x.PNG

Pretty cool right?

Tutorial 3: Line Chart with ‘Dynamic’ Colouring & Sizing

The next chart you’ll create will display the scores over time for the different DESI dimensions (the’Indicator’ measure in the dataset).

Step 1: Create the Line Chart 

Put ‘Indicator’ and ‘Year’ on Columns, ‘Weighted Score’ on Rows and ‘Country’ on ‘Detail’ on the Marks card.

If you now drag ‘Country Colours’ (the calculation from earlier) to the Marks card and put it on Color, you’ll observe the following … a fine yellow & blue line on top of a bunch grey lines (each line representing a individual country).

linechart1@2x

Notice how the order of the lines is decided by the order in the colour legend: (1) being yellow on top of (2) being blue on top of (3) being grey and that’s what we want.

colour legend@2x

Now try changing the order by for example dragging the grey box (3) to the top. What would happen with the order of the coloured lines?

Answer: because the position of the colour in the legend dictates which colour will be on top when the marks overlap, the grey lines would be on top of the yellow and blue line which would make them almost invisible; and you want them to stand out. In fact you want the yellow and blue line to be a bit thicker so they are more visible.

Step 2: Size the lines

Remember the calculation you created to colour the lines and bars?

calculationcountrycolours

If you drag ‘Country Colours’ onto ‘Size’ on the Marks card, this is what you’ll see.

linechartsize1@2x

How do you flip the result and have the yellow and blue line be thicker? You simply flip the calculation for ‘Country Colours’ by creating a second version as shown below. Notice the difference with the initial calculation?

countrycoloursedit@2x

Eh voila.

linesfinal@2x

All that’s left to do now is clean up the tooltips and you’re done. The ranking was already added to the dataset for you so there is no need to create calculations;  but if you’re feeling adventurous, give it go and feel free to share the results with me or leave a note in the comments section at the end of the blog.

Tutorial 4: Creating the ‘Chart Header’ with the dimension definitions in the tooltip

And before we can wrap this up, there is one more thing left to do. You’re going to create the ‘Chart Header’ as shown in the image at the top of the page. Instead of showing the header of the ‘Indicator’ dimension (which is what you would normally do); you want to be able to hover over each indicator and show some additional information like the description/definition of each of the indicators (read DESI dimensions).

In order to do this you’ll have to connect the second sheet of the dataset to the workbook and pull in the definition information. For the purposes of this tutorial, I’ve already added it for you (see sample workbook).

Step 1: Create the Chart Header

This is actually very simple.

Start a new worksheet and connect to the ‘DEFINITION DIMENSIONS’ datasource.

Put ‘Indicator’ on both Columns (uncheck ‘Show Header’) and Text on the Marks card and add ‘Definition’ to Tooltip. You’ll have to do some ‘clean-up’ but the end result should look something like the below.

chartheader@2x

Step 2: Align the Chart Header with the Line Chart

All that’s left to do now is adding both sheets (the Chart Header & Line Chart) to the dashboard and do some re-arranging so that things line up nicely but I will leave that up to you, pretty sure you can manage 🙂

lineandheaderchart

Thanks for reading and feel free to leave your feedback or questions in the comment section below.

Author: Marian

Tableau Fan, Foodie, Travel, Photography

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s