title: count distinct and window functions
body: <p>I have a list of IDs, transactions, the date of those transactions, and a category of those transactions. I want to create a count of each distinct category within each ID</p>
  
  <p>The starting table I have is looks something like this:</p>
  
  <pre><code>id  trxn_dt     trxn_amt trxn_category
  1   10/31/2014  58       apple
  1   11/9/2014   34       banana
  1   12/10/2014  12       apple
  2   7/8/2014    78       banana
  2   11/20/2014  99       banana
  3   1/5/2014    120      orange
  4   2/17/2014   588      apple
  4   2/18/2014   8        banana
  4   3/9/2014    65       orange
  4   4/25/2014   74       apple
  </code></pre>
  
  <p>And I want the end result to look something like this:</p>
  
  <pre><code>id  trxn_dt     trxn_amt trxn_category  number_category
  1   10/31/2014  58       apple          2
  1   11/9/2014   34       banana         2 
  1   12/10/2014  12       apple          2
  2   7/8/2014    78       banana         1
  2   11/20/2014  99       banana         1
  3   1/5/2014    120      orange         1
  4   2/17/2014   588      apple          3
  4   2/18/2014   8        banana         3
  4   3/9/2014    65       orange         3
  4   4/25/2014   74       apple          3
  </code></pre>
  
  <p>I've tried using <code>count(distinct(trxn_category)) over(partition by id,trxn_category order by id) as number_category</code> but I get an error about using 'distinct'</p>