title: Tableau Calculated Field with Max and Index
body: <p>I want to create a table with a quick filter with the top 10 records and the bottom 10 records. I created a calculated field called Index with just the INDEX() function and then created another field with the following code: </p>
  
  <pre><code>IF [Index] &gt;= 1 AND [Index] &lt;= 10 
      THEN 'Top' 
  ELSEIF [Index] &gt;= (WINDOW_MAX([Index]) - 10 )
      THEN 'Bottom'
  ELSE 
      'Do Not Display'
  END
  </code></pre>
  
  <p>However, when I drag the calculated field to the filters it only shows Top and 'All' as an option.  Even though in my table the top 10 show 'Top' and the bottom top show 'Bottom'.</p>
  
  <p>What am I doing wrong? </p>