title: Include Value From Previous Row
body: <p>I'm using SQL Server here. I have a table for inventory where only January has a beginning quantity. Each row has a changed quantity for that month.</p>
  
  <p>So..</p>
  
  <pre><code>Item | Month | Beg | PerChg
  ---------------------------
  001    1       5      5
  001    2       0     -1
  001    3       0      4
  </code></pre>
  
  <p>So in the above case, January would be 10, February 9, and March 13, and so on...</p>
  
  <p>Is it possible to take care of this line by line in SQL?</p>
  
  <p>I looked into lag briefly but I'm not so sure it does what I need or if it's the best way to go about this.</p>