Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
davymichiels
Contributor
Contributor

how to add a running total by line

Hello,

I can't figure out how to make a straight table with a calculated field at the back that is the some the value in the previous line and a field value in a column of the current line...

Difficult to explain but quite easy to accomplish in excel.... see attachment; the last column should be calculated

Somebody has an idea?

thanks

Davy

4 Replies
Gysbert_Wassenaar

In a straight table you can use inter-record functions like above, below, top and bottom. If you want the value of the row above the current one you use the above function: e.g.  =above(sum(Amount)) - sum(Amount)

In the script you can use the previous and peek functions: Peek() vs Previous() – When to Use Each


talk is cheap, supply exceeds demand
MK_QSL
MVP
MVP

How is your raw data?

I mean what are the fields you have in your base tables.

davymichiels
Contributor
Contributor
Author

Thanks I did not know that

Now need to combine it with if() function

-> something like:

if A3 = A2 then sum(G2+D3+F3), else sum(B3+D3+F3)

but for first line of the table, there is no line above so always B3+D3+F3

davymichiels
Contributor
Contributor
Author

fields incoming and outgoing come directly from 1 database, linked by article nr and description to another database with current stock value.

Field 'balance' is a calculation needed to predict stock situation after known future stock movements in/out