title: Creating calculated table with MAX and MIN dates in DAX Power BI
body: <p>I have the following table, imported in Power BI - QOL_Exp (see screenshot example below)</p>
  <p>I need to create a calculated table which will filter out values, where Rating = 999 and,
  at the same time, will pick only the highest and the lowest Date values from Date column, based on ClientID (see highlighted grey and peach colored areas).</p>
  <p>I highlighted in red font - the values that I expect to see in my calculated table</p>
  <p>For example, for ClientID = 3052 I will need the records where Date = 11/20/2020 (lowest date for this ClientID) and Date = 5/17/2021 (highest date for this ClientID)</p>
  <p>For ClientID = 2666 I will not need the record where Rating = 999 (one of the conditions)</p>
  <p>I managed to filter out (to exclude Rating = 999) but struggling with including only Max and MIN date in the new calculated table</p>
  <p><a href="https://i.stack.imgur.com/qDGPH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qDGPH.png" alt="enter image description here" /></a></p>
  <p>This is my DAX:</p>
  <pre><code>      QOL = CALCULATETABLE(QOL_Exp, QOL_Exp[Rating]&lt;&gt;999)
  </code></pre>
  <p>How should I modify it in order to only leave Max(Date) and Min(Date) records, based on ClientID?</p>
  <p>UPD:
  Based on the answer given, slightly updated (see below):</p>
  <pre><code>      QOL = 
           FILTER (QOL_Exp,  QOL_Exp[Rating] &lt;&gt; 999 
             &amp;&amp; 
                (( QOL_Exp[Date] = CALCULATE (MIN ( QOL_Exp[Date] ), 
                    ALLEXCEPT(QOL_Exp,QOL_Exp[ClientID])))
                || QOL_Exp[Date] = CALCULATE (MAX ( QOL_Exp[Date] ), 
                     ALLEXCEPT(QOL_Exp, QOL_Exp[ClientID]))))
  </code></pre>