Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
I forgot that I'd need to set up a loop with a condition to that statement. I will rephrase the xml part of the question to better reflect what I need. –  sange Mar 4 '11 at 20:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.