cancel
Showing results for
Did you mean:
Contributor III

## Sum based on previous data

Hi,

I want to sum using previous data. That is adding the previous Daily interest to the Interest  for each current day.

So, 112.83 + 0.79 = 113.62

Sample

 Transaction Date Transaction ID Interest Daily Interest 28/03/2022 1115700004 112.83 0.79

Desired Result

 Transaction Date Transaction ID Interest Daily Interest 29/03/2022 1115700004 113.62 0.72

Labels (5)

• ### Scripting

1 Solution

Accepted Solutions
MVP

one solution might be:

``````table1:
TransactionID,
DailyInterest,
RangeSum(Peek(Interest),Previous(DailyInterest)) as Interest
Inline [
TransactionDate,TransactionID,DailyInterest
27/03/2022,1115700004,112.83
28/03/2022,1115700004,0.79
29/03/2022,1115700004,0.72
30/03/2022,1115700004,0.71
31/03/2022,1115700004,0.75
01/04/2022,1115700004
];	``````

hope this helps

Marco

4 Replies
Creator III

Yes you should be able to do this at load using the Peek function :

MVP

one solution might be:

``````table1:
TransactionID,
DailyInterest,
RangeSum(Peek(Interest),Previous(DailyInterest)) as Interest
Inline [
TransactionDate,TransactionID,DailyInterest
27/03/2022,1115700004,112.83
28/03/2022,1115700004,0.79
29/03/2022,1115700004,0.72
30/03/2022,1115700004,0.71
31/03/2022,1115700004,0.75
01/04/2022,1115700004
];	``````

hope this helps

Marco

Contributor III
Author

Just out of curiosity, how would this script "RangeSum(Peek(Interest),Previous(DailyInterest))" be translated into an expression in a chart type, Many thanks.

Creator III
Community Browser