Skip to main content

unique

info

This is part of our beta expression language AQL. Learn more. Request beta.

Definition

Return a new table with all unique combination of values in the specified dimensions. It is similar to group but without the need to specify a source table. The difference is that group will only return combination of values that exist with respect to the source table, while unique will choose the source table with the most number of rows.

Syntax

unique(dimension, dimension, ...)
Examples
unique(orders.id, products.id) // -> Table(orders.id, products.id)

unique(orders.id, products.id, customers.id) // -> Table(orders.id, products.id, customers.id)

Input

  • dimension (repeatable): A fully-qualified reference to a dimension. The output table will have one row for each unique combination of values in the specified dimensions.

Output

A new table with one row for each unique combination of values in the specified dimensions.

Sample Usages

Unique orders.id and products.id
unique(orders.id, products.id)

Using unique with select just like group:

Total product by product category
unique(products.name) | select(products.name, count(products.id))

Let us know what you think about this document :)