2 Replies Latest reply on May 28, 2013 12:53 PM by Allan Walker

# Calculating the end-to-end distance between several points across several groups

Hello,

I've run into several problems trying to use the calculate distance formulas to determine the end to end distances between several points in groups. I have mapped, using a spreadsheet with latitude and longitude (not generated by Tableau), every location and I have assigned each group of locations a unique ID.

I need to calculate the distance from end to end and have had no luck using the existing knowledge base information on calculating distance between points.

As you can see from the screen captures below, the formula matches the Great Circle formula given in the Calculating Distance knowledge base. However, I was not able to inner join the table to another instance of it (unless that means to just make a copy of the worksheet in Excel and connect them together, which is what I did). I am not sure if that skews the calculations, but my guess is that my SQL is not pulling the correct latitude and longitude from adjacent points into the formula.

The number on the top (at each point) is the location ID and the number on the bottom should be the calculated distance.

• ###### 1. Re: Calculating the end-to-end distance between several points across several groups

Christine,

There is a blog post here that describes how to calculate distances without joining the data set to itself: http://vizpainter.com/mapping-distances-an-alternative-approach/

I built upon the concept described there to calculate a running total of distance.  The workbook is attached.  The whole thing is rather complex, using table calculations -- but I'd be happy to walk through any questions you might have.

Regards,

Joshua

• ###### 2. Re: Calculating the end-to-end distance between several points across several groups

Christine,

The following formula is 98% accurate using Great Circles.