Adding A Distance between (miles) Column in ETL
Comments

Are you looking for driving distance or as the crow flies?
0 
Miles would be ideal, we keep zip codes of our employee's address and our shop locations and I'd like to map out where techs we retain live compared to techs that don't make it to the 90 day mark live in comparison to their home shop.
We keep full addresses of both home and shops but I figured that may be asking for too much lol
0 
Ok, so the more I dug into this the nastier it got. But, there is a way to do it.
I found a walkthrough where a guy put together a MySQL formula for this. You'll need to find the Lat/Long values for each zip code you're wanting to use.
You can then use those with this Haversine formula:
set @orig_lat=122.4058; set @orig_lon=37.7907;set @dist=10;
SELECT *,
3956 * 2 * ASIN(SQRT( POWER(SIN((@orig_lat 
abs(
dest.lat)) * pi()/180 / 2),2) + COS(@orig_lat * pi()/180 ) * COS(
abs
(dest.lat) * pi()/180) * POWER(SIN((@orig_lon – dest.lon) * pi()/180 / 2), 2) ))
as distance
FROM hotels dest
having distance < @dist
ORDER BY distance limit 10;Here's a link to the reference:
https://www.scribd.com/presentation/2569355/GeoDistanceSearchwithMySQL
For each of the values inside SIN an COS functions, you'll need to calculate in a prior transform before calling those. It does work from what I've tested.
Hopefully this will get you started on the right track,
ValiantSpur
**Please mark "Accept as Solution" if this post solves your problem
**Say "Thanks" by clicking the "heart" in the post that helped you.0
Categories
 All Categories
 1.1K Product Ideas
 1.1K Ideas Exchange
 1.2K Connect
 969 Connectors
 256 Workbench
 Cloud Amplifier
 1 Federated
 2.4K Transform
 76 SQL DataFlows
 500 Datasets
 1.8K Magic ETL
 2.7K Visualize
 2.2K Charting
 373 Beast Mode
 20 Variables
 484 Automate
 102 Apps
 378 APIs & Domo Developer
 6 Workflows
 22 Predict
 6 Jupyter Workspaces
 16 R & Python Tiles
 316 Distribute
 64 Domo Everywhere
 252 Scheduled Reports
 59 Manage
 59 Governance & Security
 1 Product Release Questions
 5K Community Forums
 37 Getting Started
 23 Community Member Introductions
 63 Community Announcements
 4.8K Archive