function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Patrick ConnerPatrick Conner 

Summation Field Using Previous Value + Imported Value (xPost from Formulas)

I haven't received any help in formulas, so I'm thinking I might have asked in the wrong section! Thanks for looking.

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

Any insight would be greatly appreciated. Thanks!!!
nitin sharmanitin sharma
How about you trying Sum function of the aggreagte query,which will be done through trigger.Just wait for some more time,Some body might suggests you through formula fields .
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