The CountDistinct function counts the number of values in a column.
CountDistinct (numbers, break_col, break_values)
numbers references the column that contains the numbers on which the count of distinct (unique) values is calculated.
break_col is an optional parameter that references a break column.
break_value is an optional parameter that returns a distinct (unique) count of numbers column where value in break_col equals break_value.
The CountDistinct function differentiates actual values and not the rows. The Count function counts only the actual rows in a column. For example, if a column named “OS Operating Systems” has one hundred rows and shows data by Windows and UNIX systems, the CountDistinct function counts only the three operating systems and not the number of rows. |
The following examples show the results of inserting the CountDistinct function in three separate tables.
In this example, the CountDistinct function is used on the numeric column. The results are shown in the Computed column.
CountDistinct (Amount)
In this example, the CountDistinct function is used on the numeric column and break_column. The results are shown in the Computed column.
CountDistinct (Amount, State)