So in my project I have mock bank account transaction data and I'm trying to calculate the difference between two cumulative sums. I don't know if I'm going about this the right way but what I'm doing is for each day in the span of a year, I'm calculate the cumulative sum of two number fields, debit and credit. I want to figure out how to subtract the cumulative sum of debit from the cumulative sum of credit.

CumulativeDifference = CumulativeSumCredit - CumulativeSumDebit.

The main goal I'm trying to achieve is to see the balance of the bank account according to the analyzed transaction data, but I just can't seem to get there.

Any help would be appreciated, thanks in advance