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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Solution Authors