Toan Hoang

Tableau 2019.3: Distance Function

Tableau 2019.3 was released on Tuesday 17th September 2019 and comes with some very (very) nice features. In this article, we are going to spend the next 10 minutes to look into the new Distance that allows you to calculate the distance between two points.

Data

Firstly, we will grab some geographic data from Airbnb and load this into Tableau. Click on the following link and download and load into Tableau the file for your desired city: http://insideairbnb.com/get-the-data.html

Note: I am from London, so I will base the tutorial on London. But it does not matter which City you choose.

Calculated Fields

We will start by creating the following Calculated Fields, Parameters and Bins.

Parameter called Lat

Parameter called Long

Parameter called Units

Distance

DISTANCE(MAKEPOINT([latitude], [longitude]), MAKEPOINT([Lat],[Long]),[Units])

Note: What we are doing here is creating a point using the MAKEPOINT function for the data set, we are also creating a point using MAKEPOINT with the Parameters, and lastly we are using the Units parameter to allow you to select your units of measurement.

Create a Bin called Distance (bin)

And that is all we need to start building our Worksheet:

Worksheet

In this worksheet, we are going to build a map and make use of Parameter Actions. So lets get started.

We have now built our data visualization, but now I want us to add two Parameter Actions to give our dashboard some very cool interactivity.

With the Parameter Actions created, you should now be able to click on a single point, the Lat and Long parameters will be updated, and you should now see rings around this point representing the distance from this point based on your Unit settings.

You can have some fun with the Units, Bin size, Colours, and I can see many interesting applications for this newly minted function.

Note: The Distance function is currently not available in Hyper, therefore, I cannot publish this onto Tableau Public.

Summary

I hope you all enjoyed this article as much as I enjoyed writing it. Do let me know if you experienced any issues recreating this Visualisation, and as always, please leave a comment below or reach out to me on Twitter @Tableau_Magic.

If you like our work, do consider supporting us on Patreon, and for supporting us, we will give you early access to tutorials, exclusive videos, as well as access to current and future courses on Udemy:

Also, do be sure to check out our various courses:

Exit mobile version