title: Calculate value based on value from same column of the previous row
body: <p>I have an issue where I have to calculate a column using a formula that uses the value from the calculation done in the previous row.  </p>
  
  <p>I have tried the lag function but cannot get past the 2nd row.  After that all my values are null, since that column originally starts as null.  I feel like I am missing something.  </p>
  
  <p>I need to calculate a new column, using the formula:</p>
  
  <pre><code>MovingRate = MonthlyRate + (0.7 * MovingRatePrevious)
  </code></pre>
  
  <p>... where the <code>MovingRatePrevious</code> is the <code>MovingRate</code> of the prior row.  For month 1, I have the value so I do not need to re-calculate that but I need that value to be able to calculate the subsequent rows.  I need to partition by Type.  </p>
  
  <p>This is my original dataset: </p>
  
  <pre><code>Month   Type    MonthyRate  MovingRate
  --------------------------------------
  1       Blue    0.400       0.330
  2       Blue    0.300   
  3       Blue    0.700   
  4       Blue    0.900   
  </code></pre>
  
  <p>Desired results in <code>MovingRate</code> column:</p>
  
  <pre><code>Month   Type    MonthyRate  MovingRate
  ---------------------------------------
  1       Blue    0.400       0.330
  2       Blue    0.300       0.531
  3       Blue    0.700       1.072
  4       Blue    0.900       1.650
  </code></pre>