cancel
Showing results for
Did you mean:
Frequent Visitor

## Display MAX value of a Measure in a card visual based on the filtered Matrix

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support

## Re: Display MAX value of a Measure in a card visual based on the filtered Matrix

You may refer to the following post.

https://community.powerbi.com/t5/Desktop/DAX-formula-to-work-out-max-value-of-a-measure-HELP/td-p/44...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Community Support

## Re: Display MAX value of a Measure in a card visual based on the filtered Matrix

You may refer to the following post.

https://community.powerbi.com/t5/Desktop/DAX-formula-to-work-out-max-value-of-a-measure-HELP/td-p/44...

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

#### Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

#### Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors