I have the following data: ACCT TRAN_ORDER END_BAL_WITH_FEE END_BAL_NO_FEE TRANSACTION Rolling_Bal_w_FEE Rolling_Bal_wo_fee x 1 1455.27 1485.27 0 x 2 -1809.86 x 3 1000 x 4 -485 x 5 -59 x 6 50.32 x 7 -36 x 8 2300 x 9 -144.9 x 10 0.02 x 11 -13 x 12 250 x 13 -2200 x 14 -200 y 1 3023.24 3023.24 0 y 2 -22.75 y 3 -6 y 4 -55.5 y 5 -27.34 y 6 -17.14 y 7 -42.5 y 8 -10.47 y 9 -58.19 y 10 -15.49 y 11 -69.34 y 12 -2.08 y 13 50 -371.77 y 14 -500 y 15 -14 I have over 1600 accts in a specific transaction order (TRAN_ORDER). Each at TRAN_ORDER = 1 there is an ending balance with a fee and without a fee. I need to step down through the data to create two columns for a rolling balance with a fee and rolling balance without a fee. So in the above example acct x I need end_bal_w_fee + Transaction = rolling balance w fee or 1455.27 + (-1809.86) = -354.59 Then it needs to step down and do -354.59 + 1000 = 645.41 and so on until it is no longer acct x The second issue showing in acct y is that TRAN_ORDER 13 has a credit present in the end bal without fee column. while the program is stepping through the rolling balance 1 to 12 at 13 the column for rolling balance without fee needs the prior ending balance plus the credit plus the transaction so in this case 2696.44 + 50 + (-371.77) = 2374.67
... View more