title: sql server rolling 12 months sum with date gaps
body: <p>Suppose I have a table that indicates the number of items sold in a particular month for each sales rep.  However, there will not be a row for a particular person in months where there were no sales.  Example</p>
  
  <pre><code>rep_id     month_yr     num_sales    
  1          01/01/2012    3    
  1          05/01/2012    1    
  1          11/01/2012    1    
  2          02/01/2012    2    
  2          05/01/2012    1  
  </code></pre>
  
  <p>I want to be able to create a query that shows for each rep_id and all possible months (01/01/2012, 02/01/2012, etc. through current) a rolling 12 month sales sum, like this:</p>
  
  <pre><code>rep_id     month_yr     R12_Sum    
  1          11/01/2012   5    
  1          12/01/2012   5    
  1          01/01/2013   5    
  1          02/01/2013   2
  </code></pre>
  
  <p>I have found some examples online, but the problem I'm running into is I'm missing some dates for each rep_id.  Do I need to cross join or something?  </p>