title: DAX Rank by Date
body: <p>I am Counting on Distinct ID's in a column - this is leading to the sum of the subtotals not equalling the grand total as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/j1VY5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j1VY5.png" alt="enter image description here"></a></p>
  
  <p>What I want to do is rank the Payment Dates in cronological order and select ONLY the highest date to display. In the example above the Grand Total won't change, but the Townville row will not show a Distinct Student Count.</p>
  
  <p>This is a very specific requirement and I'm assuming there's an easy way to do it in DAX - I've tried playing around with both <code>RANKX</code> and <code>MAX</code> but am no closer to solving this.</p>
  
  <p>One last thing - the Rank must be contextual to the Time Filter selected by the user (so if they select 2015 it'd give the second record Rank 1 and the top record wouldn't show. If they select May 2015 it'd give the top record Rank 1 and the second record wouldn't show)</p>