ListAgg

The ListAgg function joins a given column's row values into a single list. Each window of values within a column will be aggregated into an individual list. The output of this function is a text column.

📘

The ListAgg function is an aggregate function.

Aggregate functions evaluate one or more rows of data and return a single value.

In a table element, the aggregate is calculated for each grouping. For information on how to add a grouping with an aggregate calculation to a table, see Group columns in a table.

In a table with no groupings, the aggregate is calculated for each row. For information on how to calculate summary statistics across all rows in a table, see Add summary statistics to a table.

To learn more about using aggregate functions, see Building complex formulas with grouped data.

Syntax

ListAgg([Column], separator )

Function Arguments:

  • [Column] (required) - The column of values to combine.
  • separator (optional) - The text value separator to use between values, specified within quotation marks. If no separator is specified, a comma will be used.
📘

Sort the initial input column of values to subsequently sort the resulting aggregated list. If no sort is applied to the initial column, the order of values in the resulting list will be unpredictable.

Example

ListAgg([County])

A table contains a grouped [State] column and an associated [County] column. You can use the ListAgg function to create a list of all counties within each state. No separator is indicated, so the formula uses the default separator ,.

In a table with two columns, a [State] column lists states, while a [ListAgg(County)] column lists a compiled list of all counties within that state, separated by commas.

ListAgg([County], "-")

A dash is indicated as the separator, so each value is separated by a dash.

In a table with two columns, a [State] column lists states, while a [ListAgg(County)] column lists a compiled list of all counties within that state, separated by dashes.

ListAgg([Store State], "\n")

A newline is indicated as the separator,so each value is separated onto a new line. To see these separate lines, enable text wrapping.

In a table with two columns, [Store Region] and ListAgg([Store State], '\n'), the latter column lists all store states within each region, separated onto new lines.

Related resources