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.
Syntax
ListAgg([Column], separator )
Function Arguments:
- [Column] (required) - The column of values that you would like to combine.
- separator (optional) - The separator to use between values. 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 resulting list's order of values 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 an list of all counties within each state. Here, no separator is indicated, so it defaults to a comma.
ListAgg([County], "-")
Here, a dash is indicated as the separator, so each value will be separated by a dash.