Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a matrix visual that displays the 10 closest customers (measured in Kilometers) to another customer, based on an independent slicer selection.
Customer Name | Sales Amount | Distance to Selected Customer |
Cust1 | 18 | 0.3 |
Cust2 | 71 | 0.4 |
Cust3 | 197 | 0.57 |
Cust4 | 29 | 0.87 |
Cust5 | 51 | 1.03 |
Cust6 | 5 | 1.03 |
Cust7 | 92 | 1.3 |
Cust8 | 154 | 1.56 |
Cust9 | 10 | 1.62 |
Cust10 | 13 | 2.41 |
The distance in Kilometers is calculated with the following DAX:
Distinace in Kilometers:= VAR Lat1 = MIN ( 'Customer X'[Lat] ) VAR Lon1 = MIN ( 'Customer X'[Lon] ) VAR Lat2 = MIN ( 'Customer Y'[Lat] ) VAR Lon2 = MIN ( 'Customer Y'[Lon] ) VAR P = DIVIDE ( PI (), 180 ) VAR A = 0.5 - COS ( ( Lat2 - Lat1 ) * p ) / 2 + COS ( Lat1 * p ) * COS ( lat2 * P ) * ( 1 - COS ( ( Lon2 - Lon1 ) * p ) ) / 2 VAR Final = 12742 * ASIN ( ( SQRT ( A ) ) ) RETURN Final
Ultimately, I want a dynamic measure that would display the maximum distance from CustX to CustY (in the above example, that would mean 2.41 Km) in a card visual and I am stumped.
Solved! Go to Solution.
You may refer to the following post.
You may refer to the following post.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
98 | |
79 | |
66 | |
60 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |