Forum Discussion
Distance-Based Location Highlighting
Hello,
I’m trying to calculate the distance between the assigned location and the employee’s home location using the latitude and longitude available in this file.
The objective is to identify locations that are within the selected distance range (in kilometres) using a kilometre slicer. I would like the locations that fall within the selected range to be highlighted in green, while all other locations remain grey.
Additionally, I would like the selected location to be highlighted based on the selected City, Employee Location, or StoresDummy[City] value.
I’ve also referred to the following YouTube video for guidance: youtube
Could you please help me implement this logic in Power BI/DAX?
Sample data
2 Replies
Hi Swami_om ,
For this you need to use a specific formula that is used to calculate the distance between two points on earth.
Check this post below with the calculation and also an example:
https://dax.tips/2017/05/13/dynamic-distances-in-power-bi/ (This is from a master in DAX Phil Seamark) Includes a copy of the PBIX.
Distance Calculation from Latitude & Longitude Data | Microsoft Fabric Community
Calculation distance between latitudes & Longitudes | Microsoft Fabric Community