COUNTDISTINCT

Returns the number of distinct values in a field on the child table for each parent record. The optional filter query restricts the child records that are included in the calculation.

COUNTDISTINCT ( <field_name> [, <filter_query>] )
  • field_name: The name of the field to count the distinct values from.

  • filter_query: A query string representing the domain of records to include.

Example: create a field on the CUSTOMER table to return the number of different products that each customer bought in 1994.

COUNTDISTINCT( [PRODUCT.PRODUCT_CODE] , [PRODUCT.PURCHASE YEAR] = "1994" )