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
some1else
Helper II
Helper II

Calculating distance between list of coordinates

I wonder if it's possible to calculate each row value distance compared to other rows in a column.

 

An example:

 

Untitled.jpg

 

I know the method to create this in Excel, but I was hoping for some insight into recreating this in PBI, since Excel is limited to 16k columns

 

The objective is to count the number of ocorrences, given an max distance. Like an heatmap but with numbers 🙂

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @some1else ,

 

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

 

 

Reference:

Distance Calculation in Power BI
How to calculate lat/long distance

 

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.

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @some1else ,

 

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

 

 

Reference:

Distance Calculation in Power BI
How to calculate lat/long distance

 

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.

Anonymous
Not applicable

Calculate all the distances in Power Query, then import the table into Power BI. The table can be of the form:

 

Left Point | Right Point | Distance

------------------------------------

 

From this it'll be dead easy to create what you want.

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.