title: Top 5 Items in Table
body: <p>Given the following data:</p>
  
  <p><a href="https://i.stack.imgur.com/76iXt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/76iXt.png" alt="dataset"></a></p>
  
  <p>I would like to get the top 5 results from the table. I tried the following formulas:</p>
  
  <p>Measure: <code>Violation Ranking = RANKX(ALL(Violation_Data), COUNTA(Violation_Data[Violation]))</code></p>
  
  <p>Column: <code>Top Violations = IF([Violation Ranking] &gt; 5, "Others", Violation_Data[Violation])</code></p>
  
  <p>But I'm still getting all of the results from [Violation] (I think it has something to do with the Calculated Column). I tried using a Visual Filter instead (show only [Violation Ranking] &lt;= 5), but I'm still getting the same results (the [Violation Ranking] of each [Violation] is 1 (which is odd, to say the least) that's why all of the violations are displayed.</p>
  
  <p>Anyone know how to correct the given DAX code?</p>