title: Running sum with missing dates
body: <p>I have a table of data like this:</p>
  
  <pre><code>PeriodYearMonth Reg      PartNo             ComponentRemovals   RunningRemovals
  2019 10         G-NHVP   109-0740V01-137    1                    1
  2019 11         G-NHVP   109-0740V01-137    1                    2  
  2019 12         G-NHVP   109-0740V01-137    1                    3
  2020 01         G-NHVP   109-0740V01-137    1                    4
  2019 10         OO-NSF   11-13354P          1                    1
  2019 09         G-NHVR   11-13354P          2                    2 
  2019 10         OY-HMV   11-13354P          1                    1
  </code></pre>
  
  <p>In the last column I calculated the 7-month running sum of removals per PartNo and per Reg. To do this I made the following code:</p>
  
  <pre><code>/****** Find Running Component Removals ******/
  SELECT  [PeriodYearMonth]
        ,[Reg]
        ,[PartNo]
        ,[ComponentRemovals]
        ,sum(sum(ComponentRemovals)) over (Partition by [Reg], PartNo Order By PeriodYearMonth, PeriodYearMonth rows between 6 preceding and current row) as RunningRemovals
        ,[ConfirmedFailures]
        , sum(sum(ConfirmedFailures)) over (Partition by [Reg], PartNo Order By PeriodYearMonth, PeriodYearMonth rows between 6 preceding and current row) as RunningFailures
  
    FROM [RALNHVTST].[dbo].[vtRelRepComponentsRemovalsByPartNo]
  
    Group by Reg, PartNo, ComponentRemovals, ConfirmedFailures, PeriodYearMonth
    Order by PartNo
  </code></pre>
  
  <p>However, since not all months are included in the PeriodYearMonth column the results are incorrect. I've seen solutions online for simple cases, but the tricky part for me is, that I need an entry for every PartNo, every Reg and every month.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Regards</p>