I have a Roll-Up Summary (SUM Opportunity Product) field. The field gives an option to Only records meeting certain criteria should be included in the calculation which is really good because it allows me to filter but the filter criteria only has AND option but not an OR. Why is that? And how can I workaround it? Please assist.

  • "Why is that?" Because they didn't want to make the engine overly complicated. – sfdcfox May 7 '18 at 19:51
  • why not just put a formula field on the detail that includes the OR logic and then your filter just is myFormula__c = true – cropredy May 8 '18 at 0:56

There's a couple of ways to work around this limitation.

One option, using native functionality, is to decompose your OR Roll-Up Summary into more than one Roll-Up Summary, each of which has only a single criterion, and then using a separate formula field to sum those component Roll-Up Summaries. The downside to this approach, of course, is that you consume more of your scarce limit for Roll-Up Summaries.

Another option would be to use Declarative Lookup Rollup Summaries, which (belying its name) can also work on master-detail relationships and which supports the full breadth of SOQL in defining the set of records to be included in the rollup.

  • 1
    DLRS is exactly what I recommend whenever you need something more complicated than the out-of-the-box feature, which is pretty common given its limitations. – sfdcfox May 7 '18 at 19:50
  • Same here - unfortunately some orgs are extremely reluctant to install packages and/or are in Apex limit trouble. – David Reed May 7 '18 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.