Question

I need to set up a column that will keep a running total of values. I have a program that automatically sets values for the columns in SharePoint. The program will overwrite the previous value within that column and I need a way of keeping a total from the previous and most up to date values.

I was thinking of setting up a calculated column that sums itself with the value of the updated column.

Is this possible with a calculated column? Would a workflow give me the capabilites I need?

Was it helpful?

Solution

As James has indicated, the calculated column can only work on data that currently exists in the current row, so the running total can't be done by a calculated column.

However, if I'm understanding you correctly, you could do this with two fields: - Field A - the field that your external program updates - default value of 0 - Field B - the field with the running total - default value of 0

Then you add an event receiver to the list. Any time an item in the list is created, you assign whatever is in Field A to Field B. I.e. B = A; Additionally, whenever an item in the list is updated, your event receiver can update the value of B. I.e., B = B + A;

You will want to be careful, because if a user has access to edit an item, they could edit Field B and screw up your totals.

OTHER TIPS

The formula and idea you had will generate an infinite loop.

"total of values fed in automatically from an xml" - how do you mean?

The calculate column on works on data only from the current row.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top