Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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?
Solved! Go to Solution.
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.
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.
I would do this in the Query Editor. With a table that has the two zipcode columns, you can add a custom column that makes a web call to a REST API that does this. Here is an example one - http://www.zipcodeapi.com/API#distance
You can get a free key, and then concatenate the values from your two columns into the needed URL.
If this works for you, please mark it as solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Can you please give me more direction add custom column that makes a web call to a REST API that does this? I've never used an API before so this is foreign to me.
User | Count |
---|---|
97 | |
73 | |
69 | |
43 | |
23 |