Calculating Distance between two sets of geographic coordinates using only zip codes or cities
HTML-код
- Опубликовано: 12 сен 2024
- This video used Excel data type Geography and Power Query to find the difference between 2 sets of coordinates. Using only zip codes, you can extract Lat and Long using Excel data types; these tables are then loaded into a power query to find the distance between points.
Power Query M Formula for Distance in Miles (Replace all the Bold with your column names):
Number.Acos(Number.Cos((90-[Latitude])*Number.PI/180)*Number.Cos((90-[Leads.Latitude])*Number.PI/180)
+ Number.Sin((90-[Latitude])*Number.PI/180)*Number.Sin((90-[Leads.Latitude])*Number.PI/180)*Number.Cos(([Longitude]-[Leads.Longitude])*Number.PI/180)) * 3959
Nice job. I like seeing a good application for the geographic data type. Thanks!
Finally found the solution, thank you so much for video. great Job...
I’m so glad you found this useful, and it was able to help.
Great explanation. Thank you!!!
This is brilliant. Thank you. What if I'm trying to get clusters of the lead addresses, i.e., grouping addresses that are close to each other.
Excellent 👍 🌹
I don't understand what is "lead" and why you created other columns labeled with "lead". By the way this is a great video. Thank you.
Hi @lorismetro7729 I'm glad you enjoyed the video! A lead is a sales term meaning a potential customer or prospect who has expressed interest in a product or service. I know there are many different uses for distance calculations, I come from a sales analytics background, so I put it in this context. Thank you for mentioning it, I will try and use more generic terms in the future!
Hi, is a car dirving distance? or is a air line distance between two points?
Hi! This is a direct line distance between two points.
Can we deliver this using sql server only?