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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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