Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi all!
I need your help!
I have the table 'Lat_Long' with three columns: Branch_ID, Lat, Long and I want, when I select a branch, to calculate the distance between this branch and all the other.
I 've made this measure:
Measure =
VAR Lat1 = SELECTEDVALUE('Lat_Long'[Lat])
VAR Lng1 = SELECTEDVALUE('Lat_Long'[Long])
VAR Lat2 = 'Lat_Long'[Lat]
VAR Lng2 = 'Lat_Long'[Long]
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
But, I see this error:
"A single value for column 'Lat' in table 'Lat_Long' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
Your help please!
Thank you!
Hello stathar0s,
Reading your error message and seeing where in your measure's syntax Power BI has highlighted would probably help. 🙂
Happy to help if you have more specific follow-up questions after that.
Proud to be a Super User! | |