title: MAX Value based on two Numbers and one Text
body: <p>I have a huge Order-Master-Table that contains the complete manufacturing routing for each order.
  Now I would like to determine the last tracked quantity in this table.
  The table has a structure like:</p>
  <ul>
  <li>Order Nr</li>
  <li>Prio 1 (Number)</li>
  <li>Prio 2 (Number)</li>
  <li>Prio 3 (Text)</li>
  <li>Quantity</li>
  </ul>
  <p>The measure should look at Prio 1 at first, then at Prio 2, and at last on Prio 3.
  Prio and Prio 2 are Numbers between 2 and 99 possible.
  In Prio 3 are different Text strings possible, but for the tracked quantity are just &quot;OX&quot; and &quot;OK&quot; necessary. Here has &quot;OX&quot; always more priority than &quot;OK&quot;.</p>
  <p>How would you build that as a DAX Measure?
  MAXX, CALCULATEDTABLE, RANK, TOPN?</p>
  <p>This is my first approach:</p>
  <pre><code>VAR Max1 =
      MAXX (
          ALLSELECTED ( 'Order Master' ),
          'Order Master'[Prio 1]
      )
  VAR Max2 =
      MAXX (
          ALLSELECTED ( 'Order Master' ),
          'Order Master'[Prio 2]
      )
  RETURN  
  MAXX(
      FILTER(
          'Order Master',
              'Order Master'[Prio 1] = Max1 &amp;&amp; 'Order Master'Prio 2] = Max2
      ),
      'Order Master'[Quantity]
  )
  </code></pre>