Forum Discussion
Distance DAX
Hi Everyone,
I am trying to make graph on power BI by using Longtitude and Latitude information. I want to know how can I use DAX funtion in power BI to get the distance in miles from one point to anther Point.
I am attached the map graph which I just created on Power BI.
Thanks
Are you looking for the distance of Every (all 50) points FROM the same Lat 43.72 and long -79.7 every time?
What was the first example Lat/Lon you used in testing to get 9.2 vs. 10.1? (Assuming I have 43.72 x -79.7 as the starting point)
FOrrest
13 Replies
- AlB
Community Champion
Hi Anonymous
What is the formula to get the distance based on Lat and long? Once you have it, the calculation should not be difficult.
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- AnonymousNot applicable
Hi,
I do not have formula for that, I have data which have lon and lat.
- fhill
Resident Rockstar
I had to do this recently between zip codes in Excel. You have to convert Lat & Lon cordinates into Radiant values first, then you can use the formula in the 2nd screen shot. DAX has a RADIANS, SIN & COS calcuation just like Excel.
The hard part may be how to display this information? You'll need 2 sets of Lat & Lon to perform the calcuation, and I don't know how you plan to 'match up' two points to do so?
- AnonymousNot applicable
Return
I have one set of Latitude and Longtitude only. Can you resend the 3rd screen short little bigger?
Thanks
- fhill
Resident Rockstar
=IF(SIN(D2) * SIN(D3) + COS(D2) * COS(D3) * COS(F2 - F3) > 1,
3963.1 * ACOS(1), 3963.1 *
ACOS(SIN(D2) * SIN(D3) + COS(D2) * COS(D3) * COS(F2-F3)))