title: PowerApps: Filter by multiple condition and distinct by one further condition
body: <p>My gallery shows all the records from my list in which filter statements are true, as follows:</p>
  
  <pre><code>Filter(table_name,
               Filter_A = Column_A
               And Filter_B = Column_B)
  </code></pre>
  
  <p>This works perfectly fine, but I'd need now to add another filter, as per the following logic:</p>
  
  <blockquote>
    <p>If Column_A And Column_B are non-unique, returning more than 1 row, then return only the latest Column_C (Date-Time field)</p>
  </blockquote>
  
  <p>My guess was:</p>
  
  <pre><code>Filter(table_name,
               Filter_A = Column_A
               And Filter_B = Column_B
               And Max(Column_D)
               )
  </code></pre>
  
  <p>When Filter_A = "yellow", and Filter_B = "X", my result right now looks like this:</p>
  
  <pre><code> Column_A | Column_B | Column_C | Column_D
   yellow   |    X     |    1     | 04/05/19
   Yellow   |    X     |    2     | 01/02/19
   Yellow   |    X     |    3     | 01/03/19
   Yellow   |    X     |    1     | 01/02/19
  </code></pre>
  
  <p>but I'd want this:</p>
  
  <pre><code> Column_A | Column_B | Column_C | Column_D
   yellow   |    X     |    1     | 04/05/19
   Yellow   |    X     |    2     | 01/02/19
   Yellow   |    X     |    3     | 01/03/19
  </code></pre>
  
  <p>PS
  Although I want to show in the gallery only the most recent record in case of duplicates, I still need to keep those "duplicates" on the list.
  PPS
  A perfect example of what I'm trying to do, although for sql not PowerApps, <a href="https://stackoverflow.com/questions/12496857/getting-most-recent-distinct-records">may be found here</a></p>
  
  <p>Thanks in advance for any help!</p>