0

I have a dataset in which I have a column of geographical points, and I want to calculate the total distance of the path that these geographical points cover, so that I can add it to the details of the 'route'.

What's the cleanest and simplest way to do this?

My first thought was to create another column, which is the same as this one, except shifted by a single index value, and then to use DISTANCE, and then to SUM over this, however I'm new to Tableau and I'm not even sure if something like this is possible? I'm sure there's a more elegant way to do this.

Cheers.

  • You could use the approach you mention but you'll need an additional column (or other rule) for specifying the order of the points. Another approach that could be more fruitful, especially if you expect other geospatial questions, is to store the data in a spatially aware database like PostGIS and then let the database provide functions for distance etc. You can still use Tableau for the visualization layer – Alex Blakemore Sep 07 '22 at 19:19
  • You can use the MAKELINE() and MAKEPOINT() functions – Debayan Sep 10 '22 at 04:37
  • @MKD sure, but is there any way to easily calculate the length of a line from MAKELINE()? – FairyLiquid Sep 11 '22 at 08:57

0 Answers0