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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
HenryJS
Post Prodigy
Post Prodigy

DAX calculating radius with long/lat

Hi all,

 

I use the below DAX query to calculate the distance between two points. 

 

How can I create a measure which calculates if one of the points is in a radius of the other point?

 

Distance From Compound =
var Lat1 = MIN('CandPost'[Latitude])
var Lng1 = MIN('CandPost'[Longitude])
 
var Lat2 = MIN('CompPost (2)'[Latitude])
var Lng2 = MIN('CompPost (2)'[Longitude])
---- 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
 
Thanks,
 
Henry
1 REPLY 1
blopez11
Super User
Super User

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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