Difficulty Level: Upper Beginner – Intermediate

One of the problems I encountered when I first learned Tableau was that map took up a lot of space, yet I wasn’t good enough to get much information out of it. At the time, putting a map on a dashboard was a risky decision, because I only knew how to create a simple filled map or a bubble chart on a map with Filter Actions. I knew about Mapbox but it isn’t really easy to use. Luckily, Tableau has enough features and supports to create a great dashboard with map as the central element. If you are also facing the same problem, feeling unsure about whether put that map on your dashboard, read on for some easy Tableau ‘magic’, such as this dashboard on the journey of refugees that I created.

Demo.gif

The tips I share are grouped into 2 categories, 2 for enhancing the depth of your analysis, and 4 for increasing the level of interactivity for your map dashboard. To illustrate the tips, I’ll try to create a simpler version of the above dashboard. You can download this practice Tableau workbook to follow along. In this example, I used a real dataset showing the top 10 countries of origin for refugees & their destinations since 2010 from UNHR database, plus another dataset with geocoordinates of the middle point for each country and join them together. Let’s roll!

I. Enhance the depth of your analysis

1. Incorporate Spatial Object

The first tip I would like to suggest is to incorporate spatial object. If you’ve heard of the term spatial objects before but was deterred because it sounds technical, don’t be. Spatial objects can be a point, a line or a shape (called polygon). To use spatial objects in Tableau, you can either create one from latitude and longitude using a calculated field or use a spatial file. Creating and using spatial file isn’t easy so I won’t cover it in this post. Instead, I will focus on how to create a line.

Step 1: create a point (spatial object) for countries of origin (COO) and countries of asylum (COA). I name these 2 fields ‘Geo COO’ and ‘Geo COA’ respectively

MAKEPOINT([Lat COO],[Lon COO]) // Geo COO
MAKEPOINT([Lat COA],[Lon COA]) // Geo COA

Step 2: create a line (spatial object) from COO to COA, call it ‘Geo Route’.

IF [Rank COA by Refugee Pop] <= 10 THEN MAKELINE([Geo COO],[Geo COA]) ELSE NULL END

What this formula does is that it only create a line when the Rank for Country of Asylum is less than 10. I added the IF clause because we have a lot of COA for each COO and we don’t want to show them all on the map.

2. Dual Map

Dual Map is a great way to add more depth to your map. In this section, I will show you one example of dual map using the calculated field for line we created in section 1. Please see instruction video or read on below.

Step 1: drag Geo Route, Country of Origin, and Country of Asylum into the Detail marks.
(Tableau will show a crazy nest of lines because we have quite a few countries of asylum)
Step 2: Ctrl + drag ‘Longitude (generated)’ in the column field to create a dual map
Step 3: change the type for 2nd map from Automatic to Circle. Delete Geo Route and Country of Asylum, so that the 2nd map only shows a circle for each country of origin. Drag Geo COO into detail marks because Tableau’s automatically generated position for each country is slightly different from ours.
(some dots don’t have a line because only top 10 has a list of destinations so don’t worry)
Step 4: Right-click on Longitude > Dual Axis
Step 5: To make the map more readable, let’s filter to Top 5 COO by Refugee population, and set the year to 2019 as well as Add it to context
Step 6: Change the color & size to your liking

II. Enhance the interactivity

3. Use parameter as Filter

Parameters are a great way to add more information to your map. Since the map takes up quite a bit of space, you can add parameters so that the users can choose which measure to display, like in this example. This technique can be applied anywhere but I think it’s great for maps because the map takes a lot of space and this allows us to show more than one measure in one map. Another way of using parameters is to limit the number of values to show, such as the number of countries to show on the map to make it easier to see. Let’s try 2 examples.

(a) Create a parameter to select Measure

Let’s create an option to let users see when they want to see Total Refugee Population, or just refugees under UNHCR’s mandate or only asylum seekers. See video here or read the instructions below:

Step 1: Click the ▼ in the data panel > Create parameter
Step 2: Use the following setting to create your parameter:

Step 3: Right-click on your parameter > Show Parameter Control
Step 4: Create the calculation called ‘Selected Measure’ using the newly created parameter

CASE [Select Measures]
WHEN 1 THEN SUM([Refugee Population])
WHEN 2 THEN SUM([Refugees under UNHCR’s mandate])
WHEN 3 THEN SUM([Asylum-seekers])
END

Step 5: Replace the measure SUM([Refugee Population]) with this new field in the chart.

(b) Create a parameter to show top N values

Next, let’s create a parameter so that the end-users can choose how many destination countries they want to see.

Step 1: Click the ▼ in the data panel > Create parameter
Step 2: Use the following setting to create your parameter.

Step 3: Right-click on your parameter > Show Parameter Control
Step 4: Edit the calculation for Geo Route. Instead of 10 in the If statement, we replace by our Parameter. The new formula is as below:

IF [Rank COA by Refugee Pop] <= [Top N COA]
THEN MAKELINE([Geo COO],[Geo COA])
ELSE NULL
END

4. Popped-Up Charts

Next, let’s create a dashboard so that if we click on a Country of Origin, another dashboard underneath will pop up showing the list of countries of asylum & a time series. To do this, we’ll need to use vertical/horizontal containers and Filter action (excluding all values when clearing selection) (see instruction video or read steps below)

Step 1: Create 2 worksheets to be popped-up
Worksheet 1: a bar chart for countries of asylum. Filter the COA by our Top N parameter
Worksheet 2: time series for the selected country of origin
Step 2: Create a new dashboard and drag vertical container in. Drag your map on the top and a horizontal container at the bottom inside the vertical container. Drag the bar chart & time series inside the horizontal container. The Item hierarchy in the Layout Tab should look like this:

Step 3: Add Filter Action with this setting:

Troubleshooting: If the pop-up doesn’t work somehow, make sure the top chart (the map in our case) is not Fix Height. You can check by clicking ▼ and uncheck Fix Height.

5. Set Actions

As you may have noticed, we have quite a few lines on the map especially if we set to show more than 10 countries of asylum. This can be hard to see. Let’s add action so that if we click on the Country of origin, it will show the countries of asylum, otherwise, the map will just show the bubbles for COO. To do this, we’ll need set action and some adjustments for our calculation of Geo Route. The idea behind set action is that if we don’t click on anything, nothing in the set is included in the dashboard. Once we click on a country, that country only will be included in the dashboard. (see instruction video or read steps below)

Step 1: Create an empty set for COO. Right-click on ‘Country of origin’ > Create > Sets. Name it COO Set and click OK.
Step 2: Adjust the calculation for Geo Route so that a line is created only if there is a country in the COO Set. The new formula is as below:

IF [COO Set] AND [Rank COA by Total Displaced] <= [Top N COA]
THEN MAKELINE([Geo COO],[Geo COA])
ELSE NULL
END
After editing this calculation, we’ll see that all the lines on the map disappear because nothing in the set is selected.
Step 3: Add set action by clicking Dashboard > Action > Add Actions > Change Set Values. Follow this setting:

6. Zoom-In Action

This last step is like just like icing on the cake. The goal is so that when we click on the Country of Origin, the map will zoom in to that area so that we can see the countries of asylum more clearly. (see instruction video or read below)

Step 1: Dashboard > Actions > Add Actions > Filter. Follow this setting. Instead of selecting Map in the dashboard, you have to select Map (the worksheet) instead.

Step 2: Make sure the map isn’t fixed by look at the pin button. It shouldn’t have an x on it, and should look like this:

This tip concludes my post of 6 ways to enhance your map. I hope that at least one of them is useful to enhance your mapping skills on Tableau. My next post is also about mapping, How to create density map in Alteryx vs Tableau. Stay tuned for it!

Amy Tran
Author: Amy Tran

Amy hails from Vietnam and completed a bachelor’s degree in Economics at the Australian National University. While working a marketing role in Japan, she became interested in data analysis and began self-learning Tableau. She applied to join The Data School to gain knowledge and experience working with data in order to pursue a career in data analytics. In her own time, Amy is an avid blogger and also enjoys working on craft projects.