Hi, i need help
I want substract from 9/20/2014 totreg40 - reg = ovt but when reg=0 the remainder subtract from 9/19/2014 (previous record) totreg40 - reg = ovt, etc. The sum of reg = 40.
ID FECHA REG OVT TOTREG40
230 9/15/2014 5.5 0 46.75
231 9/16/2014 8 0 46.75
232 9/17/2014 8 0 46.75
234 9/18/2014 7.75 0 46.75
297 9/19/2014 8 0 46.75
235 9/19/2014 8 0 46.75
233 9/20/2014 1.5 0 46.75
I want the result like this:
ID FECHA REG OVT TOTREG40
230 9/15/2014 5.5 0 46.75
231 9/16/2014 8 0 46.75
232 9/17/2014 8 0 46.75
234 9/18/2014 7.75 0 46.75
297 9/19/2014 8 0 46.75
235 9/19/2014 2.75 5.25 46.75
233 9/20/2014 0 1.5 46.75
Thanks