[SalesForce] How to compute the average of a sum

My report type is "As with Bs" where A and B are custom objects and B has a numeric field. In the report, I grouped the numeric field for A.

I want to display the sum of this field for each A and in the grand total I want to display the average of the sum.

If I summarise with sum and average I correctly obtain the sum for each A but the average in the grand total is on the entries.

Best Answer

I solved the issue with the Power of 1:

  • Create a new formula field in the object A with value 1.
  • Add the new formula field to the report type of choice.
  • Add a new summary column in the report. Instead of the average of the numeric field use the sum of the numeric field over the sum of the new formula field.

At subtotal, the sum of the new formula field is 1 because Salesforce use the smart sum. At grand total, the sum of the new formula field is the number of groups.

Related Topic