How do you join spatial files in Tableau?

by Sophie Higson

When would you use it?

You would use a spatial join when you have two datasets with different information, but both contain the same/similar geographical locations. Joining these would allow you to link the information for comparisons and analysis.

How do you do it?

After adding your new data source to the preview in Tableau, you can 'Add' another dataset to this. Adding another dataset will not automatically join the data where you would like, meaning you have to do it manually. To do this you need to double click on the original data source, known as 'Extract' in this example. This will open up a slightly different layout in the same location where you can drag and drop the second dataset. This will open the 'join' option and suggest different ways of combining the two datasets together. In my example I wanted the 'inner' join to only return data that matched both datasets; I wanted to discard all other data that was not present in both. You then select the two fields that are both spatial data to join upon. After, you will need to select 'intersect' to show the way they are related.

How to join your spatial data.

Your second dataset will join to the right of the original dataset.

If either of the spatial fields that you need to join are in latitude and longitude formats, then you would need to use a 'Create Join Calculation' option.

Where to find the 'Create Join Calculation'

This option will open a calculated field and you would use MAKEPOINT ([Latitude], [Longitude]), which creates a spatial point for latitude and longitude, rather than having them as separate fields. You would need to do this because you cannot join more than two columns together with one relationship; the relationship here would be 'intersects'.

What is the outcome?

In my example, the 'Extract' dataset contains the paths of storms, the storm name, season it occurred and storm ID. The 'states' data that I joined contained geographical information of US states. My join notes that whenever the 'Storm path' overlaps (intersects) with the geographical data from the US then consider this a match. I am then able to filter the storm data by just one state to see which storms passed through.

How I utilized by spatial join.

Without joining the data, Tableau would not be able to distinguish between states, or drill the data down to just one state where necessary.