title: DAX - Counting Occurrence
body: <p>I have a simple list of OpportunityIDs in a PowerPivot data model like this:</p>
  
  <pre><code>OPPORTUNITY_ID    
  1                   
  2                
  3                 
  3                 
  3                  
  4                 
  4                 
  5                 
  </code></pre>
  
  <p>And I want to add a DAX expression in a CalculatedColumn that counts the occurrence of each OpportunityID, like this:</p>
  
  <pre><code>OPPORTUNITY_ID    COUNT
  1                 1    
  2                 1
  3                 1
  3                 2
  3                 3     
  4                 1
  4                 2
  5                 1
  </code></pre>
  
  <p>So, where there are multiple occurrences of the OpportunityID, the count would show cumulatively e.g. 1,2,3 etc.</p>
  
  <p>I tried many ways of doing this but can't get anything to work.  I <em>think</em> that answer may lie in the RANKX expression, but I don't understand how to get it working.</p>
  
  <p>Any help will be greatly appreciated!</p>