Skip to main content

XNPV - script function

XNPV() returns the aggregated net present value for a schedule of cashflows (not necessarily periodic) represented by paired numbers in pmt and date, iterated over a number of records as defined by a group by clause. Rate is the interest rate per period. All payments are discounted based on a 365-day year.


XNPV(discount_rate, pmt, date)

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


  • pmt: The expression or field containing the data to be measured.
  • date: The expression or field containing the schedule of dates corresponding to the cash flow payments given in pmt.
  • discount_rate: discount_rate is the rate of discount over the length of the period.


Text values, NULL values and missing values in any or both pieces of a data-pair will result in the entire data-pair to be disregarded.

Examples and results:  

Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.


LOAD 2013 as Year, * inline [






] (delimiter is '|');



LOAD Year,XNPV(0.2, Payments, Date) as XNPV1_2013 Resident Cashflow Group By Year;

Example results
Year XNPV1_2013



Given that the Cashflow table is loaded as in the previous example:

LOAD Year,XNPV(Discount, Payments, Date) as XNPV2_2013 Resident Cashflow Group By Year, Discount;

Example results
Year Discount XNPV2_2013
2013 0.1 -$3164.35




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!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: