Yesterday marked day 4 of dashboard week, and our task was to create a visualisation using data from the World Bank. However, there was a catch – we couldn’t use Alteryx. I chose the global bilateral migration dataset, which contains information about the number of migrations from origin country to destination country, aggregrated by decade.

Prepping The Data

Given the data from the World Bank can be easily downloaded as excel files, using Tableau Prep to do my data manipulation did the trick just fine. The main issue with the data was that each decade had its own column, whereas I needed all the decades in one ‘decade’ column. To solve this I pivoted the decade columns to rows. The other part of the transformation was to bring in latitude and longitude for both origin country and destination country. This would allow me to create points and polylines in Tableau. To do this I simply brought in a text file containing latitude and longitude for every country in the world, and joined that one twice – first on origin country and then on destination country. Here is my workflow:

Building The Dashboard

The first view in my dashboard shows the top 10 destinations from an origin country. To create the flight paths I created a spatial calculation in Tableau. This is a fairly new feature and makes spatial objects much easier to create. All I had to do was create the origin and destination point from the latitudes and longitudes, and use them as the start and end point of the line. I originally wanted to parameterise this calculation to allow the user to click on any country to see their top 10, rather than have to use the filter dropdown list. However, I realised this would make getting a top 10 very difficult, and so given the time constraint I had to part it. Nonetheless, here is the calculation:

The second view was a bit trickier to create. Its an attempt at an animated bar chart, and required several complex calculations to make, which I got from this blog. The main stumbling block was trying to understand what each calculation did so that I could troubleshoot effectively. In the end I got it to work, but I would like to improve the frame rate and label positioning in the future. Here is a snippet of some of the calculations:

Finally, to make sure both views only showed the top 10 destinations, I made a rank calculation and used it as a filter. I would suggest downloading the workbook from Tableau Public if you want to interact with the animated bar chart, otherwise you have to click through each page one by one. Here is a GIF of my dashboard, which you can click to view it in Tableau Public.

What I Learned

It was good to get more practice using Tableau Prep, as well as created spatial calculations in Tableau. The main thing I learned was how to make an animated bar chart, and hopefully I can improve its performance in the future.

Come back tomorrow to see what I create, and click here to see what I created yesterday.