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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
leopoldvili_1
Helper I
Helper I

Calculate distance in proximity.

Hi, I have two tables (Table 1-250 k records )and  Table 2- (100 k records). Unfornutanly with no relationship. I would like to check if records from Table 1 is in 20 meters of proximity from each records of Table 2, and in case of calculate column with "yes".

I tried this solution, but could not make it work.

It is a pure GIS task, but is it any solution in powerbi? any feedbacks would be greatly appreciated.

Table 1.

ID

Latitude

Longitude

255

35.19856

-115.02153

320

29.935

-90.10934

 

Table 2.

Lat

Long

49.0430222

13.22595

49.04499

13.22858

5 REPLIES 5
Anonymous
Not applicable

Hi @leopoldvili_1 ,

 

You need Latitude and Longitude to calculate the distance between two locations with following formula:

 

=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon2-lon1))*6371

9.png

 

 

ps: 6371 is Earth radius in km.

 

You can achieve it via either Power Query or DAX method.

 

Or you can use Google Map API .

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you very much @

 

I applied for your formula. howewer, I am getting a lot of 0. Where it should not be. Do you know what can be the reason?

leopoldvili_1_2-1630659368361.png

 

Br,G

 

Anonymous
Not applicable

Hi @leopoldvili_1 ,

 

Sorry for my late reply.

Has your data directory been modified to the corresponding category?

7.png

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

goncalogeraldes
Super User
Super User

Hello there, what about this solution? Or this youtube video?

 

Hope this answer helps you in your problem! If you need any additional help please tag me in your reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️ or give it a kudoe 👍
Thanks!

Best regards,
Gonçalo Geraldes

@goncalogeraldes thank you for your reply. But I would like to check distances for example id 255 from Table1- for each coordinates from Table2. and in case if distance is less than 20 m, write in column "Yes". after ID 320 and etc untill it goes to all records. 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors