Put a limit on "CalcFormula = Sum ..."

On the “Bank Account Ledger Entries” page, I need to create a “Balance” field, which will depend directly on the “Amount” field of each line. Basically, the formula to calculate the “Balance” field would be “Balance = Balance + Amount”, so “Balance” would change in each line, as the amounts accumulate.

In the “Bank Account List” page there is a “Balance” field, which is calculated in the “Bank Account” table, in this way:

I need to do exactly that on the “Bank Account Ledger Entries” page, but for each line, that is, add all the “Amount” fields but only up to the date of each line.

Is there a way to limit “CalcFormula = Sum” so that it only sums up to the current line?

I am also open to other alternatives to achieve this, I am lost.

I’m not sure that can be done with a flowfield.
I’ve done something similar by creating a custom field on the page that displays a variable that is “Include in Dataset” = True. Use the OnAfterGetRecord trigger to calculate and set the variable.