I am looking for a formula field that would display on the Acocunt page and would show the total number of cases for a certain record type that were created in the last 365 days. I tried to do a rollup summary but the option for cases is not available on the account page. I can get this information in a report but i need it to display as a field on the Account page.
10 answers
Hi Jordyn - you can use a tool like DLRS (https://github.com/afawcett/declarative-lookup-rollup-summaries) to accomplish this.
Create formula checkbox on your case object like this:
Last365Days = DateValue(CreatedDate)<=Today()-365
Add a Power of 1 formula field, Case Count (number)=1
Create a number field on the account called Cases Last 365 Days
Now create your DLRS rollup like below-
Parent Object: Account
Child Object: Case
Relationship Field: Account
Criteria: Last365Days__c=True
Criteria Fields: Last365Days__c
Field to Aggregate: Case_Count__c
Action Type: Sum
Results Field: Cases_Last_365_Days__c
Set to Realtime
Deploy the Trigger
Check Active on the DLRS rollup
Be sure to install DLRS in a sandbox environment to test and confirm functionality before making specific changes iny our production environment.