Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Getting all the ZipCodes in a 25 mile radius of a selected Zip Code

Hi All,

 

I am working on a project where I need to get all the zip codes that is in a 25 mile radius of a selected zip code. 

 

I have the lat and long for all the zip codes. 

 

Can someone please help!

 

Thanks

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi, @Anonymous

You may try to use ArcGIS maps in Power BI

First thing you are going to have to do make use of the "Data Category" in the Modelling tab of the ribbon.  Next you'll need to configure your Map visual to make use of the Zip code in the "Location" section of the visual.

Then Settings and formatting for ArcGIS maps and use Drive time feature.

Reference:https://docs.microsoft.com/en-us/power-bi/power-bi-visualization-arcgis

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I am not using a map. 

 

I want to do this by using a formula to track all ZIP codes within a certain mile radius from the ZIP I enter. 

 

For example. I have a search bar visual where I enter a ZIP, I then have a grid  where it will display all ZIP within 25 miles or the ZIP I entered. 

 

This is the formula I currently have which works but most of the ZIPS are a few miles off the ZIP entered in the search bar. 

 

Miles Radius =
var Lat1 = MAX('To Zip'[Latitude])
var Lng1 = MAX('To Zip'[Longitude])

var Lat2 = MAX('From Zip'[Latitude])
var Lng2 = MAX('From Zip'[Longitude])
---- Algorithm here -----
VAR MilesCalc =ACOS(COS(RADIANS(90-Lat1)) *COS(RADIANS(90-Lat2)) +SIN(RADIANS(90-Lat1)) *SIN(RADIANS(90-Lat2)) *COS(RADIANS(Lng1-Lng2))) * 3959
RETURN MilesCalc

 

This formula works but the miles are off by a few from the entered ZIP.

 

I want the Miles from the to ZIP to be accureate and not a few miles off.

 

Please help!

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.