Generates the count of distinct values in a specified column, optionally counted by group. Generated value is of Integer type. 

NOTE: Empty string values are counted. Null values are not counted.

NOTE: When added to a transform, the function calculates the number of distinct values in the specified column, as displayed in the current sample. Counts are not applied to the entire dataset until you run the job. If you change your sample or run the job, the computed values for this function are updated. Transforms that change the number of rows in subsequent recipe steps do not affect the value for the already computed instance of COUNTDISTINCT.

pivot value: COUNTDISTINCT(name) group:postal_code limit:1

Output: Generates a two-column table containing the unique values for postal_code and the count of distinct values in the name column for that postal_code value. The limit parameter defines the maximum number of output columns.

pivot value:COUNTDISTINCT(function_col_ref) [group:group_col_ref] [limit:limit_count]

ArgumentRequired?Data TypeDescription
function_col_refYstringName of column to which to apply the function

For more information on the group and limit parameter, see Pivot Transform.


Name of the column from which to count values based on the grouping.

Required?Data TypeExample Value
YesString (column reference)myValues

Example - Simple row count