# 计数器聚合函数

计数器聚合函数用于返回通过数据加载脚本中多个记录或通过图表维度中多个值对表达式进行计数的各种类型。

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

## 数据加载脚本中的计数器聚合函数

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

#### Count

Count() 用于返回表达式中聚合的值的数量，该数量由 group by 子句定义。

[**count**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/count.htm)([**count**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/count.htm)**count**count([distinctdistinct ] expression ] expression | \* ))

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

#### MissingCount

MissingCount() 用于返回表达式中聚合的缺失值的数量，该数量由 group by 子句定义。

[**MissingCount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/MissingCount.htm)([**MissingCount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/MissingCount.htm)**MissingCount**MissingCount([ distinctdistinct ] expression ] expression))

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

#### NullCount

NullCount() 用于返回表达式中聚合的 NULL 值的数量，该数量由 group by 子句定义。

[**NullCount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/NullCount.htm)([**NullCount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/NullCount.htm)**NullCount**NullCount([ distinctdistinct ] expression ] expression))

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

#### NumericCount

NumericCount() 用于返回表达式中数值的数量，该数量由 group by 子句定义。

[**NumericCount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/NumericCount.htm)([**NumericCount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/NumericCount.htm)**NumericCount**NumericCount([ distinctdistinct ] expression ] expression))

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

#### TextCount

TextCount() 用于返回表达式中聚合的非数字的字段值的数量，该数量由 group by 子句定义。

[**TextCount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/TextCount.htm)([**TextCount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/Scripting/CounterAggregationFunctions/TextCount.htm)**TextCount**TextCount([ distinctdistinct ] expression ] expression))

## 图表表达式中的计数器聚合函数

以下计数器聚合函数可用于图表中。

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

#### Count

Count() 用于聚合每个图表维度中值、文本和数字的数量。

[**count**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/CounterAggregationFunctions/count.htm)({[SetExpression] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]]} expr)

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

#### MissingCount

MissingCount() 用于聚合每个图表维度中缺失值的数量。缺失值均是非数字值。

[**missingcount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/CounterAggregationFunctions/missingcount.htm)({[SetExpression] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]] expr)

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

#### NullCount

NullCount() 用于聚合每个图表维度中 null 值的数量。

[**nullcount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/CounterAggregationFunctions/nullcount.htm)({[SetExpression][DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]]} expr)

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

#### NumericCount

NumericCount() 用于聚合每个图表维度中数值的数量。

[**numericcount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/CounterAggregationFunctions/numericcount.htm)({[SetExpression] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]]} expr)

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

#### TextCount

TextCount() 用于聚合每个图表维度中非数字字段值的数量。

[**textcount**](https://help.qlik.com/zh-CN/sense/May2026/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/CounterAggregationFunctions/textcount.htm)({[SetExpression] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]]} expr)