+ Start a Discussion

Formula to calculate total hours

Hi, I am fairly new to customizing SalesForce and trying to figure out the best approach (formula or trigger) to the following problem:
We have a custom object called 'Contract' that has a lookup field to 'Account'.  One of the fields on the 'Contract' custom object will need to calculate (sum) all case hours where Case Account Name value is same as Contract Account Name value.  In addition to the condition just mentioned we only need case hours that fall in between the contract start date and end date (fields on the custom object).  
Can this be achieved using a formula?  I almost got it worked out using SOQL but ran into some limitations since you cannot do field comparisons.  Thanks for any help you might be able to provide!  
Best Answer chosen by Admin (Salesforce Developers) 

This was outside of the scope of a formula.  We created a custom APEX trigger for this.