How to Find # Customers with X Miles


Hi Team,
I'm hoping to find the number of customers within a given radius of a given business location. For example, how can I find how many of our customers are within 50 miles? What about within 100 miles? In order to capture ##% of our customers, how many miles do we need to travel?
These are the types of questions I'm trying to answer. All the research I've done suggests that Domo isn't the right tool for this job - but I beg to differ :)
Open to any ideas!
✅Did this solve your problem? Accept it as a solution!
❤️Did you love this answer? Mark it as "Awesome"!
👍Do you agree with this process? Click "Agree"!
Best Answers
-
I like your attitude!
I found this article on how to calculate distance in Excel: How to Calculate Distance Between Two Addresses in Excel. Beast Mode SQL doesn't support the necessary functions, but Magic does. To calculate straight line distance in miles, you'd just use this formula in Magic:
3959 * ACOS(COS(RADIANS(90 - `Latitude1`)) * COS(RADIANS(90 - `Latitude2`)) + SIN(RADIANS(90 - `Latitude1`)) * SIN(RADIANS(90 - `Latitude2`)) * COS(RADIANS(`Longitude1` - `Longitude2`)))
If you're looking for driving distance, that same article talks about using the Google Maps API to do so. Implementing it would certainly be easier with the "coming soon" feature of API requests in the Python tile, but you should still be able to achieve it today with Jupyter Workspaces or Code Engine.
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!1 -
I have a video that walks you through how to calculate distances between cities in Magic ETL. Once you calculate the distance, you can then use a filter to show which cities are within a certain range.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.1
Answers
-
I like your attitude!
I found this article on how to calculate distance in Excel: How to Calculate Distance Between Two Addresses in Excel. Beast Mode SQL doesn't support the necessary functions, but Magic does. To calculate straight line distance in miles, you'd just use this formula in Magic:
3959 * ACOS(COS(RADIANS(90 - `Latitude1`)) * COS(RADIANS(90 - `Latitude2`)) + SIN(RADIANS(90 - `Latitude1`)) * SIN(RADIANS(90 - `Latitude2`)) * COS(RADIANS(`Longitude1` - `Longitude2`)))
If you're looking for driving distance, that same article talks about using the Google Maps API to do so. Implementing it would certainly be easier with the "coming soon" feature of API requests in the Python tile, but you should still be able to achieve it today with Jupyter Workspaces or Code Engine.
Was this comment helpful? Click Agree or Like below.
Did this comment solve your problem? Accept it as the solution!1 -
I have a video that walks you through how to calculate distances between cities in Magic ETL. Once you calculate the distance, you can then use a filter to show which cities are within a certain range.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.1 -
Thank you both! Mark - I love the video. That was super helpful to see you walk through it.
I think the Distance() formula will be my best bet and can get me close. Thank you!
✅Did this solve your problem? Accept it as a solution!
❤️Did you love this answer? Mark it as "Awesome"!
👍Do you agree with this process? Click "Agree"!
0 -
@MarkSnodgrass your video was super helpful. Thanks to your help, I've got a follow up question :)
The next question is:
What distance would capture 90% of our clients? At X distance, Y% of our clients are accounted for?
This is unrelated to the original question but wanted to open back up for any insight.
✅Did this solve your problem? Accept it as a solution!
❤️Did you love this answer? Mark it as "Awesome"!
👍Do you agree with this process? Click "Agree"!
0
Categories
- All Categories
- 2K Product Ideas
- 2K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 310 Workbench
- 7 Cloud Amplifier
- 9 Federated
- 3K Transform
- 113 SQL DataFlows
- 653 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 795 Beast Mode
- 78 App Studio
- 44 Variables
- 757 Automate
- 188 Apps
- 480 APIs & Domo Developer
- 72 Workflows
- 17 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 408 Distribute
- 119 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 141 Manage
- 137 Governance & Security
- 8 Domo Community Gallery
- 47 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 41 Getting Started
- 31 Community Member Introductions
- 114 Community Announcements
- 4.8K Archive