I can't figure out why this formula is not recalculating. I've even called sObject.RecalculateFormulas and set up a debug log to see what's happening.
The field in particular is Annual_Charge_Amount__c
Debug log of database values:
Execute Anonymous: List<OpportunityLineItem> oli = [Select Id, TotalPrice, no_of_Months__c, Annual_Charge_Amount__c from OpportunityLineItem where Id = '00kj0000002xci8AAA'];
Execute Anonymous: oli[0].recalculateFormulas();
Execute Anonymous: System.debug('no_of_Months__c ' + oli[0].no_of_Months__c);
Execute Anonymous: System.debug('TotalPrice ' + oli[0].TotalPrice);
Execute Anonymous: System.debug('calc Annual_Charge_Amount__c ' + oli[0].TotalPrice / oli[0].no_of_months__c * 12);
Execute Anonymous: System.debug('actual Annual_Charge_Amount__c ' + oli[0].Annual_Charge_Amount__c);
12:20:04.2 (84302908)|USER_DEBUG|[5]|DEBUG|no_of_Months__c 46
12:20:04.2 (84402674)|USER_DEBUG|[6]|DEBUG|TotalPrice 348128.00
12:20:04.2 (84634146)|USER_DEBUG|[7]|DEBUG|calc Annual_Charge_Amount__c 90816.00
12:20:04.2 (84757614)|USER_DEBUG|[8]|DEBUG|actual Annual_Charge_Amount__c 91746.76
What exactly is going on? Could something be interrupting the update of this formula field?