Skip to main content

XIRR - script function

XIRR() returns the aggregated internal rate of return for a schedule of cash flows (that is not necessarily periodic) represented by paired numbers in pmt and date iterated over a number of records as defined by a group by clause. All payments are discounted based on a 365-day year.

Qlik's XIRR functionality (XIRR() and RangeXIRR() functions) uses the following equation, solving for the Rate value, to determine the correct XIRR value:

XNPV(Rate, pmt, date) = 0

The equation is solved using a simplified version of the Newton method.

Syntax:  

XIRR(pmt, date )

Return data type: numeric

Arguments:  

  • pmt: Payments.The expression or field containing the cash flows corresponding to the payment schedule given in date.
  • date: The expression or field containing the schedule of dates corresponding to the cash flow payments given in pmt.

Limitations:  

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.

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 '|');

 

Cashflow1:

LOAD Year,XIRR(Payments, Date) as XIRR2013 Resident Cashflow Group By Year;

Example results
Year XIRR2013

2013

0.5385

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: ampquestions@qlik.com