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
John PatinkinJohn Patinkin 

Roll-Up Summary returns different results

Hi,
I created two roll-up fields under Account (let's call them: var1 and var2).

These are the details for both of them:

Data Type: Roll-Up Summary
Summary Type: COUNT
Summarized Object: Opportunity  
Filter Criteria: Closed EQUALS True


When I check it in corresponding page layout, I get different results:

var1: 42,055

var2: 56,252

Why is there a different and how can I fix it?

Any help appreciated,

Thanks,

John.

Best Answer chosen by John Patinkin
VinayVinay (Salesforce Developers) 
Hi John,

Calculating roll-up summary field values can take up to 30 minutes, depending on the number of records affected and other factors.

Check below references.

https://help.salesforce.com/articleView?id=fields_about_roll_up_summary_fields.htm&type=5
https://salesforce.stackexchange.com/questions/138856/how-are-roll-up-summary-fields-calculated-in-the-database

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi John,

Calculating roll-up summary field values can take up to 30 minutes, depending on the number of records affected and other factors.

Check below references.

https://help.salesforce.com/articleView?id=fields_about_roll_up_summary_fields.htm&type=5
https://salesforce.stackexchange.com/questions/138856/how-are-roll-up-summary-fields-calculated-in-the-database

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
This was selected as the best answer
John PatinkinJohn Patinkin

Thank you for your answer.

I am not sure that both fields will be equal cause the numbers jump in every refresh:

First refresh:

var1: 23,242

var2: 67,355

Second refresh:

var1: 48,663

var2: 27,639

If var2 was 67K, how it becomes to 27K?

John PatinkinJohn Patinkin

It will be one hour after creating both vars so honnestly, I dont know what I'm doing wrong.

VinayVinay (Salesforce Developers) 
Just curious,  why do you need to create 2 rollup summary fields with the same criteria?  

Since calculations are done backend there might be conflict in values for two fields with the same criteria.  You can try using custom logic if you need to populate value.

Thanks,
John PatinkinJohn Patinkin

Thanks Vinay again.

I will tell you from the start:

I was trying to count the number of closed opportunities.

So I declared: closedOpportunities with the relevant logic (close=true).

In order to verify my function output, I created two more fields:

1. openOpportunities (close=false).

2. allOpportunities (close=true OR close = false).

Then I checked if openOpportunities + closedOpportunities = allOpportunities.

When I see that it doesnt equal, I created another closeOpportunities and checked if it's equal to the other closeOpportunuties.

When I see it doesn't equal, I posted this topic.

 

So if I want to count the number of closed opportunities, is my function from the topic is the right answer?

Thank you very much, please let me know so I will mark your answer as best answer.

 

VinayVinay (Salesforce Developers) 
This seems to be Know Issue with salesforce,  Kindly review below details.

https://trailblazer.salesforce.com/issues_view?id=a1p3A00000030w6QAA

Another KI around Roll-up Summary:
https://trailblazer.salesforce.com/issues_view?id=a1p3A000000IYvUQAW

Hope this helps...

Thanks,