> 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.

# ArrayAggDistinct

This function isn't compatible with all data platform connections. To check if your connection supports it, see [Supported data platforms and feature compatibility](/docs/region-warehouse-and-feature-support#supported-data-platforms-and-feature-compatibility).

The **ArrayAggDistinct** function identifies distinct non-null row values in a column or group and aggregates them into a single array.

The **ArrayAggDistinct** 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).

## Syntax

```
ArrayAggDistinct(value, [direction])
```

Function arguments:

<table>
  <tbody>
    <tr>
      <td>
        **value**
      </td>

      <td>
        (required) The column containing values to join.
      </td>
    </tr>

    <tr>
      <td>
        **direction**
      </td>

      <td>
        <p>(optional) The directional order to sort the column values.</p>

        <ul><li>`“asc”` sorts values in ascending order.</li><li>`“desc”` sorts values in descending order.</li></ul>

        <p>When a direction isn’t specified, Sigma sorts values in the same order as the column referenced in the **value** argument. If the referenced column isn’t sorted, Sigma sorts values in ascending order by default.</p>
      </td>
    </tr>
  </tbody>
</table>

## Example

```
ArrayAggDistinct([Product Type], “asc”)
```

For each grouping (grouped by order number) the **ArrayAggDistinct** function returns an array containing distinct non-null values—sorted in ascending order—from the corresponding rows in the *Product Type* column.

![Table showing product data grouped by order number, with a column aggregating distinct product type values using the ArrayAggDistinct function.](https://files.buildwithfern.com/sigma.docs.buildwithfern.com/a5266e3026a381a4e6ec182c39ca8051ebc8d1d43d4f380f91452ee29573d8ac/assets/docs-images/e409c19-image.png)