0:00One of the great new features in 2019.3 is
0:04the ability to do distance calculations in
0:07Tableau. You'll see here that I've got a
0:10pickup point and a drop off point. And I've
0:12created
0:13these by using the make point function with
0:15the drop off latitude and longitude, and
0:18the
0:18pickup latitude and longitude for the
0:20pickup point. Now what I'd like to do is
0:22calculate
0:23the distance between these two locations.
0:25In order to do this, I need to just create
0:27a new calculation. I'll make this larger so
0:29you can see. And I'll just start typing
0:32distance and you can see there's a new
0:34function in here called distance. If I look
0:36on the
0:37right hand side here, I'm actually able to
0:39see that what I need to do is reference the
0:42start, the finish and then the distance
0:44unit in kilometers. So let's start by
0:47bringing
0:47the pickup point. You can also just type
0:49this out. So if I just type in drop off
0:52point,
0:52you'll see that Tableau auto completes. I
0:55hit a comma and then in single speech marks
0:58,
0:58I'll just put kilometers for the units that
0:59I need. I'll then just say distance in
1:05kilometers.
1:05Now one thing to note is that Tableau will
1:08calculate the distance as the bird flies.
1:11So it will basically draw a straight line
1:13from one location to the next location. So
1:15think
1:15of this more like a radius from start to
1:18finish. I hit apply. And now you'll see I
1:21have distance
1:21units. To visualize this, I'll bring this
1:23into columns and then you'll see the total
1:27distance
1:28from all my data points. And then if I
1:30bring the trip ID for this taxi data, you
1:33'll see that I
1:34actually get a bar chart showing all the
1:37distances. If I then add this as a filter
1:40and then also just put it in detail,
1:51I can start working with this like I would
1:53any other data set and I can start
1:56filtering
1:56various trips in and out of my data set. So
2:00it's a really powerful feature to be able
2:02to do this
2:02directly in Tableau. Typically, you'd have
2:05to pre-calculate these outside of Tableau.
2:07You can actually see in my data, I have
2:09trip miles already pre-calculated,
2:11but this comes from the taxi directly. That
2:14's it.