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
Soledad AngelSoledad Angel 

Compile error

Hi,

I am trying to do some forecasting, so I created Head count (#) and  a Revenue field (formula, rate * Head count * Probability)  and now I need to calculate impact on FY. 

My formula is very basic (see below), the issue is that I can only go to 9, not to 12 as needed, I get the error "too large to compile".

Suggestions?

_________________________

CASE(

ROUND((( DATEVALUE( "2015-04-01" ) - CloseDate ) / 30 ), 0 ),

1, WRM_1__c ,
2, ( WRM_1__c + WRM_2__c ) ,
3, ( WRM_1__c + WRM_2__c + WRM_3__c ) ,
4, ( WRM_1__c + WRM_2__c + WRM_3__c + WRM_4__c ) ,
5, ( WRM_1__c + WRM_2__c + WRM_3__c + WRM_4__c + WRM_5__c ) ,
6, ( WRM_1__c + WRM_2__c + WRM_3__c + WRM_4__c + WRM_5__c + WRM_6__c  ) ,
7, ( WRM_1__c + WRM_2__c + WRM_3__c + WRM_4__c + WRM_5__c + WRM_6__c + WRM_7__c ) ,


0
)
Best Answer chosen by Soledad Angel
Soledad AngelSoledad Angel
Solved it.

The only work around is to split formula in non-formula fields and reference to those. The non-formula fields are updated thanks to field update workflows, which do include the formulas needed. Once that is done, it is easy to obtain the result.

So, in this case,
1) Created a formula field:  "Month in Year" : ROUND((( DATEVALUE( "2015-04-01" ) - CloseDate ) / 30 ), 0 )
2) Created number field"First half year" and "second half year" :
3) Created Workflows with field update actions: that includes the formula pasted above for "first half year", and the subsequent numbers (7-12) for "second half year"
4) The final, needed, formula: would be ( " first half year " + " second half year" ) 

All Answers

Shyam BhundiaShyam Bhundia
This might help:
"This limit is the same for all Salesforce editions: Maximum formula size (in bytes) when compiled: 5,000 bytes. When your formula exceeds this limit, the error message says, “Compiled formula is too big to execute (13,974 characters). Maximum size is 5,000 characters.”

Check out this document on tip to reduce the size  https://help.salesforce.com/help/pdfs/en/salesforce_formula_size_tipsheet.pdf
Soledad AngelSoledad Angel
Solved it.

The only work around is to split formula in non-formula fields and reference to those. The non-formula fields are updated thanks to field update workflows, which do include the formulas needed. Once that is done, it is easy to obtain the result.

So, in this case,
1) Created a formula field:  "Month in Year" : ROUND((( DATEVALUE( "2015-04-01" ) - CloseDate ) / 30 ), 0 )
2) Created number field"First half year" and "second half year" :
3) Created Workflows with field update actions: that includes the formula pasted above for "first half year", and the subsequent numbers (7-12) for "second half year"
4) The final, needed, formula: would be ( " first half year " + " second half year" ) 
This was selected as the best answer
Shyam BhundiaShyam Bhundia
awesome!