Calculating Distance between two sets of geographic coordinates using only zip codes or cities

preview_player
Показать описание
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!

ziggle
Автор

Hi, is a car dirving distance? or is a air line distance between two points?

MatteoBorghesialquati
Автор

Can we deliver this using sql server only?

SauravDas-vn
Автор

Finally found the solution, thank you so much for video. great Job...

naturelover
Автор

this is ridiculous...way too fast to be helpful

gametime
Автор

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.

patrickdowe
Автор

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.

lorismetro