# Funciones básicas de agregación

Las funciones básicas de agregación son un grupo de las funciones de agregación más comunes.

Utilice el desplegable de cada función para ver una breve descripción y la sintaxis de cada función. Haga clic en el nombre de la función en la descripción de la sintaxis si desea más detalles.

## Funciones básicas de agregación en el script de carga

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### FirstSortedValue

Los valores ordenados se repiten a lo largo de una serie de registros, definidos por una cláusula group by, o se agregan a todo el conjunto completo de datos si no se ha definido ninguna cláusula group by.

[**firstsorted**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/firstsorted.htm)([**firstsorted**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/firstsorted.htm)**firstsorted**firstsorted([ distinctdistinct ] expression , sort-weight [, n ] ] expression , sort-weight [, n ]))

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Max

Max() encuentra el valor numérico más alto de los datos agregados en la expresión, según lo definido por una cláusula group by. Al especificar un rank n, puede hallarse el valor enésimo más alto.

[**max**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/max.htm)([**max**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/max.htm)**max**max( expression[, rank] expression[, rank]))

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Min

Min() devuelve el valor numérico más bajo de los datos agregados en la expresión, según lo definido por una cláusula group by. Al especificar un rank n, puede hallarse el enésimo valor más bajo.

[**min**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/min.htm)([**min**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/min.htm)**min**min( expression[, rank] expression[, rank]))

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Mode

Mode() devuelve el valor numérico más repetido, el valor de la moda, de los datos agregados en la expresión, según lo definido por una cláusula group by. La función Mode() puede devolver tanto valores numéricos como de texto.

[**mode**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/mode.htm)([**mode**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/mode.htm)**mode**mode(expression expression ))

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Only

Only() devuelve un valor si hay únicamente un resultado posible en los datos agregados. Si los registros dentro de cada resultado agrupado definido por una cláusula group by contienen únicamente un valor, entonces devuelve dicho valor. Si no, devuelve NULL

[**only**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/only.htm)([**only**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/only.htm)**only**only(expression expression ))

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Sum

Sum() calcula el total de los valores agregados en la expresión, según lo definido por una cláusula group by.

[**sum**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/sum.htm)([distinct]expression)

## Funciones básicas de agregación en expresiones de gráficos

Las funciones de agregación en gráficos sólo pueden emplearse sobre campos en expresiones de gráficos. La expresión del argumento de una función de agregación no deberá contener otra función de agregación.

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### FirstSortedValue

La función FirstSortedValue() devuelve el valor de la expresión especificado en value que se corresponda con el resultado de ordenar el argumento sort\_weight, teniendo en cuenta rank, si se especifica. Si más de un valor obtenido comparte el mismo sort\_weight para el rank especificado, la función devuelve NULL.

[**firstsortedvalue**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/BasicAggregationFunctions/firstsortedvalue.htm)([{SetExpression}] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]] value, sort\_weight [,rank])

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Max

Max() halla el valor más alto de los datos agregados. Al especificar un rank n, puede hallarse el valor enésimo más alto.

[**max**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/BasicAggregationFunctions/max.htm)([{SetExpression}] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]] expr [,rank])

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Min

Min() halla el valor numérico más bajo de los datos agregados. Al especificar un rank n, puede hallarse el enésimo valor más bajo.

[**min**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/BasicAggregationFunctions/min.htm)([{SetExpression}] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]] expr [,rank])

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Mode

Mode() halla el valor que más veces aparece, el valor de la moda, en los datos agregados. La función Mode() puede procesar tanto valores numéricos como valores de texto.

*[**mode**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/BasicAggregationFunctions/mode.htm)*({[SetExpression] [TOTAL [&lt;fld {,fld}&gt;]]} expr)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Only

Only() devuelve un valor si hay únicamente un resultado posible en los datos agregados. Por ejemplo, al buscar el único producto donde el precio de unidad es = 9 devolverá un valor NULL en caso de que más de un producto tenga un precio de unidad de 9.

[**only**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/only.htm)([{SetExpression}] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]] expr)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/Scripting/AggregationFunctions/basic-aggregation-functions.htm)

#### Sum

Sum() calcula el total de valores especificados por la expresión o campo en los datos agregados.

[**sum**](https://help.qlik.com/es-ES/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/BasicAggregationFunctions/sum.htm)([{SetExpression}] [DISTINCT] [TOTAL [&lt;fld {,fld}&gt;]] expr])