# Thread: Alternative to Cumulative Sum (Group by)

1. Junior Member
Join Date
Sep 2012
Posts
10

## Alternative to Cumulative Sum (Group by)

I'm trying to make a aggregated sum field of a profit. So far, it was a very good alternative. Now i have a problem when the profit goes to 0 (a Withdrawal) the sum must start again, but i really don't know how to do that.

One case when that happends is below:

 Fecha Equity Profit NetoDepRet Deposito Withdrawal 2012-02-24 22.013,30 ,00 19.288,26 ,00 ,00 2012-02-27 21.817,89 ,00 19.288,26 ,00 ,00 2012-02-28 22.110,94 ,00 19.288,26 ,00 ,00 2012-02-29 21.978,38 ,00 19.288,26 ,00 ,00 2012-03-01 ,00 -22.033,92 -22.033,92 ,00 -22.033,92 2012-03-02 ,00 ,00 ,00 ,00 ,00 2012-03-05 32.670,93 32.827,25 32.827,25 32.827,25 ,00<-Deposit 2012-03-06 31.495,61 ,00 30.081,59 ,00 ,00 2012-03-07 31.730,74 ,00 30.081,59 ,00 ,00 2012-03-08 32.326,39 ,00 30.081,59 ,00 ,00 2012-03-09 32.325,28 ,00 30.081,59 ,00 ,00
30.081, 59 = 19.288,26 + -22.033,92 + 32.827,25

Any idea?

Best Regards,

Daniel

2. Chief Data Integration
Join Date
Nov 1999
Posts
9,729
Daniel, the algorithm will start from 0 when you have a different group.
So I would create another field that increments when profit is 0.
Alternatively you could simply calculate another field (corrected profit) that corrects the profit value to your liking.