XIRR
XIRR()returns the aggregated internal rate of return for a schedule of cash flows (that is not necessarily periodic) represented by paired numbers in the expressions given by pmt and date iterated over the chart dimensions. 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([TOTAL [<fld {,fld}>]] 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.
- 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. The TOTAL qualifier may be followed by a list of one or more field names within angle brackets <fld>. These field names should be a subset of the chart dimension variables.
Limitations:
pmt and date must not contain aggregation functions, unless these inner aggregations contain the TOTAL qualifier. For more advanced nested aggregations, use the advanced function Aggr, in combination with a specified dimension.
Text values, NULL values and missing values in any or both pieces of a data-pair result in the entire data-pair being disregarded.
Examples and results:
XIRR(Payments, Date): 0.5385.
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 '|');