Built-in Functions → distinct

distinct() is an aggregation function that returns the number of distinct elements in a column.


distinct(<object> expr, [groupBy(...)])
  • expr : any Incorta column data type
  • groupBy : optional grouping function that specifies which group of data to operate over

If you use the groupBy function, you must include all the leading grouping dimensions in the Insight from the top-down to the level-based measure you want to evaluate. For more information, refer to Aggregation with a Level Based Measure.


long or as many longs as there are groups if groupBy is used


  • Determine the number of different (distinct) models sold.
  • Determine the number of different models sold by city.
distinct(Sales_Acme.Sales.model_name, byGroup(Sales_Acme.Sales.city))