Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hey All!
I am trying to make a contact list that I can filter via business type, and distance to a certain location. The filtering through business type is working perfectly, just set up a slicer and choose the business type. However, I cannot seem to get the Distance Filter to work.
I have based a lot of this tool on a project that was posted online at this link below.
https://dataveld.com/2019/03/20/display-points-within-a-distance-radius-on-a-power-bi-map/
The person who made with was able to choose one city & state, and then filter out locations that were not within the range chosen.
I have been trying to do the exact same thing, each business has been assignd a Longitude and Latittude, and based off the Job Location, I am trying to filter out anyone that is not within the range chosen.
Shown below is my Export Table, this shows all the businesses that have ben filtered down via there type and proximity to a job. The 'City' & 'State' Columns are the businesses location. The 'Distance (km)' column is working correctly, the numbers given are correct and when I change the Job Location, the numbers given in this column adjust correctly. So as far as I can tell this part is working correctly.
For some reason the 'Points in Proximity' column does not work properly. As you can see, every business appears to be "Out of Range". Even though their Distance from the Job Location is <= to the Max Distance. In this case the Maximum Distance is 120 KM. Ideally everything with a Distance less than or equal to the chosen Maximum Distance (120 KM) would show as "In Range", but for whatever reason that is not the case.
Points in Proximity = IF('Organization_Info'[Distance (km)] <= 'Maximum Distance (km)'[Maximum Distance (km) Value],"In Range","Out of Range")
The Max Distance is just a generated series of numbers so that I can choose a radius around the Job Location.
I have a Measure of this series so that I can create the IF statement in the 'Points in Proximity' measure.
I cannot figure out why the 'Points in Proximity' measure is not working properly, either my IF statment is not correct or the 'Maximum Distance' measure is not correct. They both look correct to me, but clearly I am wrong, so any help would be appreciated.
Solved! Go to Solution.
I didn't solve this problem directly but I was able to solve it indirectly. I was able to remove the 'Max Distance' Slicer and replace with a column called Area of Operation in a table also called 'Area of Operation'.
I made a new table, called Area of Operation, that had the name of each organization and then a column that contained the operating radius of that company in kilometers. So then I changed my Points in Proximity equation. You will see that monay of the business have a 5000 KM range. This just means they will travel/deliver anywhere within the state or country and they will always return "In Range". While other companies have a much smaller range of operation.
I didn't solve this problem directly but I was able to solve it indirectly. I was able to remove the 'Max Distance' Slicer and replace with a column called Area of Operation in a table also called 'Area of Operation'.
I made a new table, called Area of Operation, that had the name of each organization and then a column that contained the operating radius of that company in kilometers. So then I changed my Points in Proximity equation. You will see that monay of the business have a 5000 KM range. This just means they will travel/deliver anywhere within the state or country and they will always return "In Range". While other companies have a much smaller range of operation.
Having looked over what you've posted I'm pretty sure you really want Points in Proximity to be a measure because it has to respond to the choices of the slicers.
So rework that as a measure and see how you get on
Points in Proximity is already a Measure.
Points in Proximity = IF('Organization_Info'[Distance (km)] <= 'Maximum Distance (km)'[Maximum Distance (km) Value],"In Range","Out of Range")
First of all, measures should not be used in calculated columns. I see quite a few examples of this on the forum and it's a bad idea.
The other problem though is that you might be assuming what the number is that you are getting from that measure.
Am i right in saying the calculated column Points in Proximity is created in the 'Organization_Info' table? What value is supposed to be returned from the 'Maximum Distance (km)' table to use it in a comparison? I don't see any relationship so the SELECTEDVALUE will probably be returning the 1st or last value in the table and I don't think that's what you want.
HotChilli, I love your name thanks for helping me out lol.
1. The reason I used a measure in the calculated column, was because I'm not sure how else I could accomplish that calculation, but if you know better then I would happily use your suggestion.
2. You are correct in saying that the PiP is created in the 'Organizational_Info' table.
3. 'Maximum Distance (km)' is supposed to simply serve as a radius around a city. That number is then compared to the 'Distance' calculation for a given business. Any business within that radius will appear as "In Range", or just filter out any business not in the radius.
4. Yeah I am confused on how SELECTEDVALUE is supposed to work. I pulled most of what I am doing from that link I provided at the top. The person who made that project provided a github download and I have been trying to recreate what they did.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
89 | |
87 | |
82 | |
64 | |
49 |
User | Count |
---|---|
123 | |
109 | |
87 | |
67 | |
66 |