The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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! | |
User | Count |
---|---|
15 | |
13 | |
9 | |
6 | |
6 |
User | Count |
---|---|
29 | |
19 | |
13 | |
8 | |
5 |