Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey,
I wanted to know that once I have plotted several locations on a map in Power BI, how can I calculate the distance between any two locations?
Solved! Go to Solution.
do you have LAT and LONG? If yes you can do it with math:
if not you need to custom call Bing Maps or Google Maps APIs for that
You need Latitude and Longitude to calculate the distance between two locations with following formula:
=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon2-lon1))*6371
ps: 6371 is Earth radius in km.
You can achieve it via either Power Query or DAX method.
Or you can use Google Map API as @cs_skit suggested.
Regards,
I did a blog post on calculating the direct line distance between two points in DAX
http://radacad.com/dynamic-distances-in-power-bi
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |