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
Leonard Silon 11Leonard Silon 11 

Can I calculate a rolling 12 months of revenue from one object to the next?

I have Object A and OBJECT B. B is the detail and A the master in a master-detail relationship
B will get records with dollar amount many times a month
On A I would like to have a total of those amounts on B but only a rolling last 12 months

Is there a way to do this without a trigger? I can total them easily but how to do the rolling 12 months?
Best Answer chosen by Leonard Silon 11
Gokula KrishnanGokula Krishnan
Hi Leonard,

You can create a formula field(checkbox) in Object B.
And check your condition as,
IF( (LastmodifiedDate - Today() ) <365, TRUE,FALSE)

And in Object A, Create a roll-up summary field and use filter option, to check the above created Formula field(Checkbox) equals to TRUE.

Thanks..

If it helps you, please mark is as best answer, so it will be helpful for other developers.

All Answers

Gokula KrishnanGokula Krishnan
Hi Leonard,

You can create a formula field(checkbox) in Object B.
And check your condition as,
IF( (LastmodifiedDate - Today() ) <365, TRUE,FALSE)

And in Object A, Create a roll-up summary field and use filter option, to check the above created Formula field(Checkbox) equals to TRUE.

Thanks..

If it helps you, please mark is as best answer, so it will be helpful for other developers.
This was selected as the best answer
Leonard Silon 11Leonard Silon 11
OMG that is brilliant – UGH I hate when I do not think of the “easy” stuff like that. Thank you sir
Gokula KrishnanGokula Krishnan
Welcome..

If it helps you, please mark is as best answer, so it will be helpful for other developers.
Leonard Silon 11Leonard Silon 11
CRAP!!! You can not use a formula field in the criteria of a roll up summary field.
Gokula KrishnanGokula Krishnan
But I have check with account to rollup opportunity, its showing formulas field in criteria.

Could you check again 
 
Leonard Silon 11Leonard Silon 11
I was working on fiscal year that starts on 4/1. So in my process building had two conditions. This way I account for the first 3 months and then the rest of the year

First was
AND(
           ISPICKVAL([Account_Assets_Flows__c].Asset_or_Flow_type__c , "Flow"),
OR(
        MONTH([Account_Assets_Flows__c].Flow_Post_Date__c )  >= 4,
        AND(
                  MONTH([Account_Assets_Flows__c].Flow_Post_Date__c)   < 4,                  
                  MONTH(TODAY()) < 4
                )
))

And second was 
AND(
           ISPICKVAL([Account_Assets_Flows__c].Asset_or_Flow_type__c , "Revenue"),
OR(
        [Account_Assets_Flows__c].Revenue_Date_Month__c  >= 4,
        AND(
                  [Account_Assets_Flows__c].Revenue_Date_Month__c  < 4,                  
                  MONTH(TODAY()) < 4
                )
))