title: How to I use the MAX function in power bi only on the filtered records?
body: <p>I am trying to select the record with the latest date, all of the records in the database have these basic columns AssetNumber, WorkOrderNumber, ScheduledEndDate, Department</p>
  
  <p>I want to find all the latest work order "date" for each asset in a specific department. I have a basic measure and column to do this but it is not working. </p>
  
  <p>How do I filter the records and then apply the max date function. I have tried using ALL, ALLEXCEPT, ALLSELECTED etc.</p>
  
  <pre><code>| ASSET | DEPARTMENT | WOSCHED_ENDDATE |
  |-------|------------|-----------------|
  | 2160  | 57257E     | 11/29/2011      |
  | 2160  | 57257E     | 7/28/2014       |
  | 6440  | 57257E     | 3/5/2012        |
  | 6440  | 57257E     | 3/9/2015        |
  </code></pre>
  
  <p>At the basic level I need to remove the two records with the old dates from my visual. I can find the most recent (MAX) date of the entire column but I cannot get the MAX function to work in the context of the filtered values which by department like I have in the sample grid. </p>
  
  <p>Thank you</p>