title: Filter a column which is less than a certain value that is derived from another formula, then get the maximum value
body: <p>I have a table which contains grades of all students. Suppose I have a value <code>UpperLimit</code> which is derived from another formula, how to get the highest grade which is less than the <code>UpperLimit</code>?</p>
  
  <p>Example:</p>
  
  <pre><code>Grade
  -----
  18
  72
  43
  100
  65
  75
  </code></pre>
  
  <p>If the <code>UpperLimit</code> is 75 (after being calculated), then it should return 72, since 72 is the highest number below 75.</p>
  
  <p>My idea is to filter the table/column first which is less than <code>UpperLimit</code>, then get the maximum value from it. Currently, my code is like this:</p>
  
  <pre><code>MAXX(
      FILTER(
          VALUES(Student[Grade]),
          Student[Grade] &lt; [UpperLimit]
      ),
      Student[Grade]
  )
  </code></pre>
  
  <p>However, it returns 100 instead (the highest <em>overall</em> value).</p>
  
  <p>Could someone explain why it returns 100, and how to fix the formula in DAX?</p>