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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
SURYA3696
Frequent Visitor

Distance Calculation from Latitude & Longitude Data

Hello All,

 

I am trying to generate distance in KM from the Latitude & Longitude data that I have. The dataset contains more than 3000 lines and the frequency of data output is at a time interval of every 5 seconds. I initially tried to produce distance by dividing the speed (km/hr) by 5 seconds in Hours. But the distance I calculated did not look realistic (incorrect). 

 

Can someone help with this please. PBI Query.PNG

2 ACCEPTED SOLUTIONS
edhans
Super User
Super User

You need to use the haversine formula. There is no built in function for this in DAX or M, but the underlying functions are there, like SIN() in DAX or Number.Sin in M.

Seems pretty straightforward, just a bit tedious to build.

edhans_0-1694049990183.png

 


https://www.omnicalculator.com/other/latitude-longitude-distance#the-haversine-formula-or-haversine-...



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

Hello edhans, 

 

Thank you for the solution. This is definitely worked. 

View solution in original post

2 REPLIES 2
edhans
Super User
Super User

You need to use the haversine formula. There is no built in function for this in DAX or M, but the underlying functions are there, like SIN() in DAX or Number.Sin in M.

Seems pretty straightforward, just a bit tedious to build.

edhans_0-1694049990183.png

 


https://www.omnicalculator.com/other/latitude-longitude-distance#the-haversine-formula-or-haversine-...



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Hello edhans, 

 

Thank you for the solution. This is definitely worked. 

Helpful resources

Announcements
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.

Top Solution Authors
Top Kudoed Authors