Skip to main content Skip to complementary content

NPV - script function

The NPV() script function takes a discount rate and multiple values ordered by period. Inflows (incomes) are positive, and outflows (future payments) are assumed to be negative values for these calculations. These occur at the end of each period.

Net Present Value, or NPV, is used to calculate the current total value of a future stream of cash flows. To calculate NPV, we need to estimate future cash flows for each period and determine the correct discount rate. The NPV() script function takes a discount rate and multiple values ordered by period. Inflows (incomes) are positive, and outflows (future payments) are assumed to be negative values for these calculations. These occur at the end of each period.

Syntax:  

NPV(discount_rate, value)

Return data type: numeric. By default, the result will be formatted as currency.

The formula to calculate net present value is:

Formula for calculating NPV.

where:

  • Rt= Net cash inflow-outflows during a single period t

  • i = Discount rate or return that could be earned in alternative investments

  • t = Number of timer periods

Arguments
Argument Description
discount_rate

discount_rate is the percentage rate of discount applied.

A value of 0.1 would indicate a 10% discount rate.

value

This field holds values for multiple periods ordered by period. The first value is assumed to be the cashflow at the end of period 1, and so on.

Limitations:  

The NPV() function has the following limitations:

  • Text values, NULL values and missing values are disregarded.

  • Cashflow values must be in order of ascending period.

When to use it

NPV() is a financial function used to check project profitability and to derive other measures. This function is useful when cashflows are available as raw data.

Regional settings

Unless otherwise specified, the examples in this topic use the following date format: MM/DD/YYYY. The date format is specified in the SET DateFormat statement in your data load script. The default date formatting may be different in your system, due to your regional settings and other factors. You can change the formats in the examples below to suit your requirements. Or you can change the formats in your load script to match these examples. For more information, see Modifying regional settings for apps and scripts.

Default regional settings in apps are based on the user profile. These regional format settings are not related to the language displayed in the Qlik Cloud user interface. Qlik Cloud will be displayed in the same language as the browser you are using.

If you are an app creator, you can set the default region for apps you create. For more information, see Setting your preferred regional settings for creating apps and scripts in Qlik Cloud Analytics.

Example 1 – Single payment (script)

Example 2 – Multiple payments (script)

Example 3 – Multiple payments (script)

Example 4 – Project profitability example (script)

Learn more

 

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!