title: Partition Function COUNT() OVER possible using DISTINCT
body: <p>I'm trying to write the following in order to get a running total of distinct NumUsers, like so:</p>
  
  <pre><code>NumUsers = COUNT(DISTINCT [UserAccountKey]) OVER (PARTITION BY [Mth])
  </code></pre>
  
  <p>Management studio doesn't seem too happy about this. The error disappears when I remove the <code>DISTINCT</code> keyword, but then it won't be a distinct count.</p>
  
  <p><code>DISTINCT</code> does not appear to be possible within the partition functions. 
  How do I go about finding the distinct count? Do I use a more <em>traditional</em> method such as a correlated subquery?</p>
  
  <p>Looking into this a bit further, maybe these <code>OVER</code> functions work differently to Oracle in the way that they cannot be used in <code>SQL-Server</code> to calculate running totals.</p>
  
  <p>I've added a live example here on <a href="http://sqlfiddle.com/#!3/a54aa/2" rel="noreferrer">SQLfiddle</a> where I attempt to use a partition function to calculate a running total.</p>