# Financial aggregation functions

This section describes aggregation functions for financial operations regarding payments and cash flow.

Use the drop-down on each function to see a brief description and the syntax of each function. Click the function name in the syntax description for further details.

## Financial aggregation functions in the data load script

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/financial-aggregation-functions-script.htm)

#### IRR

IRR() returns the aggregated internal rate of return for a series of cash flows represented by the numbers in the expression iterated over a number of records as defined by a group by clause.

[**IRR**](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/IRR.htm)(expression)

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/financial-aggregation-functions-script.htm)

#### XIRR

XIRR() returns the aggregated internal rate of return (yearly) 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.

[**XIRR**](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/XIRR.htm)(valueexpression, dateexpression )

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/financial-aggregation-functions-script.htm)

#### NPV

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.

[**NPV**](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/NPV.htm)(rate, expression)

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/financial-aggregation-functions-script.htm)

#### XNPV

XNPV() returns the aggregated net present value for a schedule of cashflows (not necessarily periodic) represented by paired numbers in pmt and date. All payments are discounted based on a 365-day year.

[**XNPV**](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/XNPV.htm)(rate, valueexpression, dateexpression)

## Financial aggregation functions in chart expressions

These financial aggregation functions can be used in charts

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/financial-aggregation-functions-script.htm)

#### IRR

IRR() returns the aggregated internal rate of return for a series of cash flows represented by the numbers in the expression given by value iterated over the chart dimensions.

[**irr**](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FinancialAggregationFunctionsInCharts/irr.htm)[TOTAL [&lt;fld {,fld}&gt;]] value)

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/financial-aggregation-functions-script.htm)

#### NPV

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.

[**npv**](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FinancialAggregationFunctionsInCharts/npv.htm)([TOTAL [&lt;fld {,fld}&gt;]] discount\_rate, value)

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/financial-aggregation-functions-script.htm)

#### XIRR

XIRR() returns the aggregated internal rate of return (yearly) 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.

[**xirr**](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FinancialAggregationFunctionsInCharts/xirr.htm)([TOTAL [&lt;fld {,fld}&gt;]] pmt, date)

[](https://help.qlik.com/en-US/sense/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/financial-aggregation-functions-script.htm)

#### XNPV

XNPV() returns the aggregated net present value for a schedule of cash flows (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.

[**xnpv**](https://help.qlik.com/en-US/sense/May2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FinancialAggregationFunctionsInCharts/xnpv.htm)([TOTAL [&lt;fld{,fld}&gt;]] discount\_rate, pmt, date)