Skip to main content Skip to complementary content

NPV - chart function

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 the chart dimensions. The payments and incomes are assumed to occur at the end of each period.

Syntax:  

NPV([TOTAL [<fld {,fld}>]] discount_rate, value)

Return data type: numeric The result has a default number format of money.

Arguments:  

Argument Description
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.
TOTAL

If the word TOTAL occurs before the function arguments, the calculation is made over all possible values given the current selections, and not just those that pertain to the current dimensional value, that is, it disregards the chart dimensions.

By using TOTAL [<fld {.fld}>], where the TOTAL qualifier is followed by a list of one or more field names as a subset of the chart dimension variables, you create a subset of the total possible values.

See: Defining the aggregation scope

The TOTAL qualifier may be followed by a list of one or more field names within angle brackets. These field names should be a subset of the chart dimension variables. In this case, the calculation is made disregarding all chart dimension variables except those listed, that is, one value is returned for each combination of field values in the listed dimension fields. Also, fields that are not currently a dimension in a chart may be included in the list. This may be useful in the case of group dimensions, where the dimension fields are not fixed. Listing all of the variables in the group causes the function to work when the drill-down level changes.

Limitations:  

discount_rate and value must not contain aggregation functions, unless these inner aggregations contain the TOTAL qualifier. For more advanced nested aggregations, use the advanced aggregation function Aggr, in combination with calculated dimensions.

Text values, NULL values and missing values are disregarded.

Examples and results:  

Example Result
NPV(Discount, Payments) -$540.12

Data used in examples:

Cashflow:

LOAD 2013 as Year, * inline [

Date|Discount|Payments

2013-01-01|0.1|-10000

2013-03-01|0.1|3000

2013-10-30|0.1|4200

2014-02-01|0.2|6800

] (delimiter is '|');

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!