NPV() returns the aggregated net present value of an investment based on a discount_rate per period and a series of future payments (negative values) and incomes (positive values), represented by the numbers in value, iterated over a number of records, as defined by a group by clause. The payments and incomes are assumed to occur at the end of each period.
Return data type: numeric. The result has a default number format of money.
|discount_rate||discount_rate is the rate of discount over the length of the period.|
|value||The expression or field containing the data to be measured.|
Text values, NULL values and missing values are disregarded.
Examples and results:
Add the example script to your app and run it. Then add, at least, the fields listed in the results column to a sheet in your app to see the result.
LOAD 2013 as Year, * inline [
] (delimiter is '|');
LOAD Year,NPV(0.2, Payments) as NPV1_2013 Resident Cashflow Group By Year;
Given that the Cashflow table is loaded as in the previous example:
LOAD Year,NPV(Discount, Payments) as NPV2_2013 Resident Cashflow Group By Year, Discount;
Note that the Group By clause sorts the results by Year and Discount. The first argument, discount_rate, is given as a field (Discount), rather than a specific number, and therefore, a second sorting criterion is required. A field can contain a different values, so the aggregated records must be sorted to allow for different values of Year and Discount.