# ArrayAggDistinct

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

### Syntax

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

Function arguments:

|               |                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **value**     | (required) The column containing values to join.                                                                                                                                                                                                                                                                                                                                                                                                             |
| **direction** | <p>(optional) The directional order to sort the column values.</p><ul><li><code>“asc”</code> sorts values in ascending order.</li><li><code>“desc”</code> sorts values in descending order.</li></ul><p>When a direction isn’t specified, Analytics Pro sorts values in the same order as the column referenced in the <strong>value</strong> argument. If the referenced column isn’t sorted, Analytics Pro sorts values in ascending order by default.</p> |

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

<figure><img src="https://files.readme.io/e409c19-image.png" alt=""><figcaption></figcaption></figure>
