You need to sign in to do that
Don't have an account?
Pug
Financial functions (NPV, PMT...) in salesforce
I'm trying to solve calculating NPV from values in a custom object. Can someone tell how to go about do this before I begin programming it manually?
Since I'm rather new to Force.com and Java (background is .Net), here is how I plan on implementing this:
1. Create an Apex utility class that would contain methods for calculating financial functions like NPV
2. Create an Apex trigger to update a custom field with the result of the calculation
Seems strange that SalesForce would not include these standard functions in their formula library. I guess sales people are using tools outside of SF to determine the value of deals.
Hi
Was wondering if you have the code for NPV.
Thank you
Zubin
Was wondering if you have the code for NPV.
Hi,
can you please share code for NPV. I am also trying to implement it and facing issue with it.
Appreciate your help for this.
Thanks,
Pradeep
I acutally just implemeted this as a standard formula field. Of course the exact solution for you will depend on the information you've captured in the opportunity.
There is one MAJOR limitattion to this solution: it does not work for an unlimited time period.
In my case I have the number of Years on an opportunity. Basically I use a series of if statements that return either the NPV for a given year or a 0 depending on the number of years that has been entered.
The end result is a formula that looks like this:
Net Present Value = NONDISCOUNTED AMOUNTS
+ IF( DURATION > 1, (Annual Amount) / Interest),0)
+ IF( DURATION > 2, (Annual Amount) / Interest ^ 2),0)
+ IF( DURATION > 3, (Annual Amount) / Interest ^ 3),0)
etc.
I've validated my results against Excel's NPV function as well as hand calculations based on this:
http://www.financeformulas.net/Net_Present_Value.html
Keep in mind the tiem period limitation. In my example above a fourth year would not be calculated. This may not meet your requirements. Doing NPV properly with support for any time period requires a loop, and formulas can't loop. This is a decent accurate hack for me until I upgrade editions.