MIP Logo

Using Spatial Equations in Tableau:

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here. 

Unlike Alteryx Designer which has an extensive list of spatial tools and equations, Tableau offers equations with spatial capabilities that are more targeted towards the simple visualization side of analysis: Distance, Makepoint and Makeline under the spatial calculation options.

BUT WAIT….

There is a further calculation offered by Tableau that allows a buffer, offered in the newly released 2020.1. A buffer, if you are unaware, is a circular area around a point with a given radius. This radius is set in the calculation, having the notation; Buffer(Spatial Point, distance, “units”).

NIck created an excellent blog on Buffer Equations here, but for my blog, I wanted to focus on the use cases and a dynamic buffer option.

 

Use Cases of a Buffer Equation:

  1. You want your retail stores not to be cannibalizing one another within a 5km radius, so in Tableau you could create the equation Buffer( (MAKEPOINT([Store Location Lat], [Store Location Long]) ,5,”km”). This will allow you to see if stores are overlapping.
  2. Use in conjunction with spatial joins to analyse how many customers are in a certain area. E.g. Inner Join – Create Join Clauses: Source A. Previous Equation, Source B. Makepoint(Customer Lat, Customer Long)
  3. Use in conjunction with spatial joins to analyze which customers aren’t within a radius of a stores. Now you would use a Left Join (If your buffer is on the right), and see which customers have null with the buffer field.
    1. Continuing from this, you may want to see the maximum distance that point would need to travel. What you could do is increase the buffer radius until it is within the boundary of a store location and use the distance equation to find how far that customer needs to travel. Note the distance equation does not work with buffers, it works with points.

 

Making a Dynamic Buffer:

You can use a parameter in replace of the distance in the buffer location to make the buffer dynamic. This parameter would need to be an integer, and this obviously will not work on a static join. The whole premise of this could be used for example but having a big ass number up the top of the dashboard on the percentage of stores within the buffer range, and by changing the parameter you might be changing the cost and that percentage, potentially leading to a feasibility question.

 

Switching To Alteryx:

Unfortunately, Tableau is still limited in its spatial analytics calculations, especially for polygons, which is why Alteryx is great to bring in for data prep. In Alteryx, you can create negative buffers for instance, when you have a polygon and want to reduce the area. This may be useful for a delivery company for instance, where you want to see the impact if you reduce the area in which a store operates its delivery.

 

Final Comment:

Workout Wednesday had a great example to practice buffer equations here. My advice before you get stuck into the challenge, understand the data first and what it is that it is asking for.

Share this post