# 财务聚合函数

本部分介绍财务运作中与付款和现金流相关的聚合函数。

使用每个函数的下拉列表可查看每个函数的简短描述和语法。单击语法描述中的函数名称可了解更多信息。

## 数据加载脚本中的财务聚合函数

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

#### IRR

IRR() 函数用于返回聚合内部回报率，以揭示迭代于 group by 子句定义的大量记录上的表达式的数值表示的现金流系列。

[**IRR**](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/IRR.htm)(expression)

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

#### XIRR

XIRR() 函数用于返回聚合内部回报率（每年），以揭示迭代于 group by 子句定义的大量记录上的 pmt 和 date 表达式的成对数值表示的现金流时间表（不必为周期性的）。 所有付款按 365 天一年年折扣。

[**XIRR**](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/XIRR.htm)(valueexpression, dateexpression )

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

#### NPV

NPV() 脚本函数接受贴现率和按期间排序的多个值。在这些计算中，流入（收入）为正值，流出（未来付款）为负值。这些发生在每个周期结束时。

[**NPV**](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/NPV.htm)(rate, expression)

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

#### XNPV

XNPV() 函数用于返回聚合净现值，以揭示 pmt 和 date 表达式的成对数值表示的现金流时间表（不必为周期性的）。 所有付款按 365 天一年年折扣。

[**XNPV**](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/FinancialAggregationFunctions/XNPV.htm)(rate, valueexpression, dateexpression)

## 图表表达式中的财务聚合函数

以下财务聚合函数可用于图表中。

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

#### IRR

IRR() 用于返回通过在图表维度上迭代的 value 指定表达式中数值表示的一系列现金流的聚合内部回报率。

[**irr**](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/FinancialAggregationFunctionsInCharts/irr.htm)[TOTAL [&lt;fld {,fld}&gt;]] value)

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

#### NPV

NPV() 用于根据每周期的 discount\_rate 和通过图表维度迭代 value 的数值表示的一系列未来付款（负值）和收入（正值）返回投资聚合净现值。假设为在每个周期结束时发生的付款和收入。

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

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

#### XIRR

XIRR() 用于返回通过图表维度迭代 pmt 和 date 指定表达式中成对数值表示的现金流（不必为周期性的）时间表（即不一定是周期性的）。 所有付款按 365 天一年年折扣。

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

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

#### XNPV

XNPV() 用于返回通过图表维度迭代 pmt 和 date 指定表达式中成对数值表示的现金流时间表（不一定是周期性）的聚合净现值。 所有付款按 365 天一年年折扣。

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