Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All, this is my first post, so please be gentle with me.
I have a requirement to find locations within a fixed distance from a provided location.
My data model is as follows:
I am trying to achieve the following :-
Can anyone help with this please? I am really stuck.
Solved! Go to Solution.
hi, @ainsleybilton
You could try this way:
Step1:
Create a duplicate locations table as targe locations table.
target locations = locations
target site name = LOOKUPVALUE(Sites[Site Name],Sites[ID],'target locations'[ID])Step2:
Kilometers =
var Lat1 = MIN('locations'[lat])
var Lng1 = MIN('locations'[lng])
var Lat2 = MIN('target locations'[lat])
var Lng2 = MIN('target locations'[lng])
---- Algorithm here -----
var P = DIVIDE( PI(), 180 )
var A = 0.5 - COS((Lat2-Lat1) * p)/2 + COS(Lat1 * p) * COS(lat2 * P) * (1-COS((Lng2- Lng1) * p))/2
var final = 12742 * ASIN((SQRT(A)))
return final
Step5:Amount = IF([Kilometers]<=[Distance Value],CALCULATE(COUNTA(employees[Employee Name]),ALL(Sites)))Step6:
hi, @ainsleybilton
You could try this way:
Step1:
Create a duplicate locations table as targe locations table.
target locations = locations
target site name = LOOKUPVALUE(Sites[Site Name],Sites[ID],'target locations'[ID])Step2:
Kilometers =
var Lat1 = MIN('locations'[lat])
var Lng1 = MIN('locations'[lng])
var Lat2 = MIN('target locations'[lat])
var Lng2 = MIN('target locations'[lng])
---- Algorithm here -----
var P = DIVIDE( PI(), 180 )
var A = 0.5 - COS((Lat2-Lat1) * p)/2 + COS(Lat1 * p) * COS(lat2 * P) * (1-COS((Lng2- Lng1) * p))/2
var final = 12742 * ASIN((SQRT(A)))
return final
Step5:Amount = IF([Kilometers]<=[Distance Value],CALCULATE(COUNTA(employees[Employee Name]),ALL(Sites)))Step6:
Hey @v-lili6-msft , sorry to comment on something that's a bit old... do you know if there's limits to the amount of data this can process? I am looking at 18M addresses, and whilst following this pretty closely, i keep hitting the available resources problem.
As an additional bit of information, I tried using a calculated table to get the distance between the locations as below:
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 69 | |
| 32 | |
| 27 | |
| 26 |