+ Start a Discussion
Patrick ConnerPatrick Conner 

Summation Field Using Previous Value + Imported Value

We have a field "Lifetime__c", that we would like to show a summation of all hourly imported values (importing to "Imported__c"). A simple formula field seems circular (Lifetime__c + Imported__c = Lifetime__c). What is the best way to go about this? Is there a way to create a field that does not overwrite, but adds on? A better formula field? Triggers? Roll-Up Summary Fields??

The goal is to have Lifetime__c updated hourly with a numerical value being imported (and overwritten) hourly to Imported__c like thus:

Hour 0: Imported__c - 5 Lifetime__c - 5
Hour 1: Imported__c - 3 Lifetime__c - 8
Hour 2: Imported__c - 7 Lifetime__c - 15
etc...

Any insight would be greatly appreciated. Thanks!!!

AgiAgi
Hi,

this can be achieved with three fields and a workflow rule:

1)  Imported__c , field type: number

2) Total_Lifetime__c, field type number

3) Lifetime__c, formula field, return type:number,
formula:    Total_Lifetime__c

workflow rule:
Evaluation Criteria: created, and every time it’s edited
Rule Criteria: ISCHANGED(Imported__c )

add immediate workflow action, Field update
Field to Update:  Total_Lifetime__c
Specify New field value:    PRIORVALUE( Lifetime__c ) +  Imported__c

activate the workflow rule, and remove Lifetime__c from page layout
then the value in Imported_c will be added to prevoius value in Total_Lifetime__c