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
AndyuxAndyux 

Counting cases per account

i have accomplished this in a long and manual way with many rollup fields. I think there has to be a better way so starting over, with your help.

I need to calculate the average number of cases per quarter. Cases is a custom object. Rolloup average does not work becasue it counts all accounts when calculating the average. I need to NOT count the accounts that did not have any cases, so my total number of accounts changes every quarter.

I already have a rollup that counts the cases per quarter (in the account object), so i can tell if an account has cases or not.

How do i get the total number of accounts that had cases (case count>0)?

Can Account object be the summarized object, if i create a new object just for this purpose? theres got to be a better way.
Mubeen QawiMubeen Qawi
Hello Andyux,

I am not sure the context of your requirements for calculating total # of Account which has Cases and other statistics. Given that, I would suggest looking at Salesforce Reports to start with. You should be able to get all the neccessary stats / numbers from there. For instance,

How do I get the total number of accounts that had cases (case count>0)? 
Create a Account report. In the filter criteria select Case Count ROll Up Summary field that you might have created. Select the criteria as Case Count great than 0. On the Report Preview section, change the report type to Matrix Report. Drag and Drop Account Name field or any field you want to summarize. Please ensure to select the Detail view in the Show option. Run the Report, in the Grant total section of the report (scroll down all the way) to get Total number of Accounts which has Case created or tied to it.

Similarily, you should be able to create other report for different aspects of Support Services. However, for other requirements such as... 

 I need to calculate the average number of cases per quarter?
Again if you are looking to summarize Case creation matrices with other data sets such as Accounts, Close rates, etc. then Salesforce out of box report should be of great assistance. However, If you are looking for a singular Account view with Total Number Case created all time, quarterly breakdown of Cases, and other such matrcies. Then yes, custom development / Custom object to store that data set is the way to go. This matrices are similar to how Salesfoce does Sale Forecast reports per Sales Reps / Opportuntiies etc. I dont think Roll Up Summary fields will help you, here. 

Hope this helps. There is not silver bullet esp. with Roll Up Summary and other Salesforce declerative tools.

Mubeen Qawi