> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# ListAggDistinct

> Use the Sigma ListAggDistinct function to join multiple values from a column into a list (as a single text string).

The **ListAggDistinct** function joins multiple values from a column into a list (as a single [text](/docs/data-types-and-formats#text) string). Each window of values within the column is aggregated into an separate list.

> **Info**
>
> The **ListAggDistinct** 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](/docs/create-and-manage-tables#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](/docs/create-and-manage-tables#add-summary-statistics-to-a-table).
>
> To learn more about using aggregate functions, see [Building complex formulas with grouped data](https://www.sigmacomputing.com/resources/training-videos/table-grouping-and-functions#complex-formulas).

## Usage

```sigma
ListAggDistinct(value, [separator], [direction])
```

Function arguments:

|               |                                                                                                                                                                                              |
| :------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **column**    | (Required) The column of values to be joined.                                                                                                                                                |
| **separator** | (Optional) The separator to add between values.If no separator is specified, a comma is used.                                                                                                |
| **direction** | (Optional) The direction in which the list is sorted.Can be `"asc"` (ascending order) or `"desc"` (descending order).If no direction is specified, the values are sorted in ascending order. |

## Examples

**Example 1:**

```sigma
ListAggDistinct([Store Name])
```

A table contains a grouped *Store State* column. Outside the grouping, there are orders for stores within the state. **ListAggDistinct** is used to return a list of distinct store names within each state. When neither the separator or direction is specified, the distinct values in the output are separated by a comma and sorted in ascending order.

![Table with Store State and ListAggDistinct of Store Name columns, listing the distinct store names in each state separated by commas, such as Norfolk Store #36 for Arkansas.](/_fern-files/_img/350a40a8636461630dedd3278fbd013fd615b79bb7201cfbf2630600d56b3507.webp)

**Example 2:**

```sigma
ListAggDistinct([Store Name], "-")
```

When a dash (`-`) is specified as the separator, each distinct value in the output is separated by a dash.

![Table with Store State and ListAggDistinct of Store Name columns, listing the distinct store names in each state separated by dashes, such as Carlton Store #889-Union Store #318 for Kansas.](/_fern-files/_img/0d11fec9dc466fc5bbd90bc33b97d9107485b8333725bee4ae4da13307062815.webp)

**Example 3:**

```sigma
ListAggDistinct([Store Name], "-", "desc")
```

When the direction is specified as `desc`, the output is sorted in descending order.

![Table with Store State and ListAggDistinct of Store Name columns, listing store names in descending order separated by dashes, such as Union Store #318-Carlton Store #889 for Kansas.](/_fern-files/_img/1c5fb730e54da325377e08faf7db470a4ccee3c30554fde5c47bb0b86d1f3939.webp)

**Example 4:**

```sigma
ListAggDistinct([Store State], "\n")
```

When the newline character (`\n`) is used as the separator argument, each value is displayed on its own line *if **Wrap text** formatting is applied to the column*.

![Table with Store Region and ListAggDistinct of Store State columns with the Wrap text option in the toolbar, showing each state on its own line, such as Massachusetts, New Hampshire, and New Jersey for the East region.](/_fern-files/_img/0499e5748c1bbbfb1a984520739c9357e673ad1e698fcf1afa714d629caff2e0.webp)

## Related resources

* [ListAgg](/docs/listagg)
* [Concat](/docs/concat)