## Forum Discussion

StevenPearson
Qrew Assistant Captain
3 years ago

# Running Total

I can't seem to find a solution anywhere so here is my question:
I have 4 fields. A, B, C, D
D is a formula field that totals A, B, &C.
I want to be able to adjust A, B or C and have the new total for D to reflect the changes in addition to what the total was previously.
Any thoughts?

------------------------------
Steven Pearson
------------------------------
• PaulPeterson1
Qrew Assistant Captain
You can use something like this:

``````var number A = SumValues(GetRecords("{3.LTE." & [Record ID#] & "}"), fidA);
var number B = SumValues(GetRecords("{3.LTE." & [Record ID#] & "}"), fidB);
var number C = SumValues(GetRecords("{3.LTE." & [Record ID#] & "}"), fidC);

\$A + \$B +\$C​``````

Replace fidA, fidB, and fidC with the field ID for your Fields A, B, and C.

One Caveat with this approach, if the table is large or has several inter app relationships, using three formula queries in one field could degrade performance.
------------------------------
Paul Peterson
------------------------------

• PaulPeterson1
Qrew Assistant Captain

Improved suggestion to limit the number of formula queries, create a new field that will get the total for A, B and C, in my test I called it Temp Total

------------------------------
Paul Peterson
------------------------------