# 字符串聚合函数

本节介绍字符串相关的聚合函数。

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

## 数据加载脚本中的字符串聚合函数

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

#### Concat

Concat() 用于组合字符串值。此脚本函数用于返回迭代于 group by 子句定义的许多记录的所有表达式值的聚合字符串串联。

[**concat**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/concat.htm)([**concat**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/concat.htm)**concat**concat([ distinct ] expression [, delimiter [, sort-weight]][ distinct ] expression [, delimiter [, sort-weight]]))

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

#### FirstValue

FirstValue() 用于返回首先从表达式定义的记录加载，然后通过 group by 子句排序的值。

信息注释此函数仅可用作脚本函数。

[**FirstValue**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/FirstValue.htm) ([**FirstValue**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/FirstValue.htm)**FirstValue**FirstValue (expressionexpression))

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

#### LastValue

LastValue() 用于返回最后从表达式定义的记录加载，然后通过 group by 子句排序的值。

信息注释此函数仅可用作脚本函数。

[**LastValue**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/LastValue.htm) ([**LastValue**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/LastValue.htm)**LastValue**LastValue (expressionexpression))

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

#### MaxString

MaxString() 用于查找表达式中的字符串值，并返回通过 group by 子句定义的大量记录按字母顺序排序的最后一个文本值。

[**MaxString**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/MaxString.htm)([**MaxString**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/MaxString.htm)**MaxString**MaxString(expression expression ))

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

#### MinString

MinString() 用于查找表达式中的字符串值，并返回通过 group by 子句定义的大量记录按字母顺序排序的第一个文本值。

[**MinString**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/MinString.htm)([**MinString**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/Scripting/StringAggregationFunctions/MinString.htm)**MinString**MinString(expression expression ))

## 图表中的字符串聚合函数

以下图表函数可用于在图表中聚合字符串

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

#### Concat

Concat() 用于组合字符串值。该函数用于返回通过每个维度计算的所有表达式值的聚合字符串串联。

[**concat**](https://help.qlik.com/zh-CN/sense/November2025/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/StringAggregationFunctions/concat.htm)({[SetExpression] [DISTINCT] [TOTAL [&lt;fld{, fld}&gt;]] string[, delimiter[, sort\_weight]])

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

#### MaxString

MaxString() 用于查找表达式或字段中的字符串值，并以字母排序顺序返回最后一个字母值。

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

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

#### MinString

MinString() 用于查找表达式或字段中的字符串值，并以字母排序顺序返回第一个文本值。

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