Forum Discussion
Anonymous
6 years agoNot applicable
Calculate distance between Zip Codes?
I have a table with two fields as zip codes. An origination zip code and a destination zip code. I would like to calculate the milage between the two zip codes. How would I do this?
- 6 years ago
Hi Anonymous ,
The Latitude and Longitude are needed 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 may also achieve it via either Power Query or DAX method. Or you can use Google Map API .
Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Community Champion
6 years agoI did this once: https://community.powerbi.com/t5/Quick-Measures-Gallery/Going-the-Distance/m-p/963267#M423