Forum Discussion
Show distance between two points
- 1 year ago
Hello Henrique_Quint
Yes that is possible use below DAX code
Distance (km) =
VAR Lat1 = RADIANS([Latitude Start])
VAR Lon1 = RADIANS([Longitude Start])
VAR Lat2 = RADIANS([Latitude End])
VAR Lon2 = RADIANS([Longitude End])
VAR DLat = Lat2 - Lat1
VAR DLon = Lon2 - Lon1
VAR A =
POWER(SIN(DLat / 2), 2) +
COS(Lat1) * COS(Lat2) * POWER(SIN(DLon / 2), 2)
VAR C = 2 * ATAN2(SQRT(A), SQRT(1 - A))
VAR EarthRadius = 6371 -- Kilometers
RETURN
EarthRadius * C
Thanks,
Pankaj Namekar | LinkedInIf this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.
- 1 year ago
Hi Henrique_Quint ,
Reshape the data in Power Query to create two rows per deliver- one for the start point and one for the end point, with unified Latitude, Longitude, and a Point Type column then plot them in ArcGIS using Point Type as legend.
If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
- one for the start point and one for the end point, with unified Latitude, Longitude, and a Point Type column then plot them in ArcGIS using Point Type as legend.
Hello Henrique_Quint
Yes that is possible use below DAX code
Distance (km) =
VAR Lat1 = RADIANS([Latitude Start])
VAR Lon1 = RADIANS([Longitude Start])
VAR Lat2 = RADIANS([Latitude End])
VAR Lon2 = RADIANS([Longitude End])
VAR DLat = Lat2 - Lat1
VAR DLon = Lon2 - Lon1
VAR A =
POWER(SIN(DLat / 2), 2) +
COS(Lat1) * COS(Lat2) * POWER(SIN(DLon / 2), 2)
VAR C = 2 * ATAN2(SQRT(A), SQRT(1 - A))
VAR EarthRadius = 6371 -- Kilometers
RETURN
EarthRadius * C
Thanks,
Pankaj Namekar | LinkedIn
If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.