COUNTDISTINCT

The following section describes the syntax and usage of the COUNTDISTINCT function in ActivityInfo.

Description

The COUNTDISTINCT function is used to count all unique, defined values in a set of values. If a value is not defined or empty, or has already appeared in the set, then it is not included in the count.

Syntax

COUNTDISTINCT(val1, val2, ...)

Argument Required Description
val1 Yes A value.
val2 No Another value.
... No Any further values.

If an argument is missing or NA, it will be excluded from the calculation.

Result

The count of all unique, defined values found in the input set.

Example

We will be using the COUNT function to calculate the number of unique, defined row values from a set of three columns.

Arguments

We will be using three Quantity fields:

  • "Value 1" (with code "val1")
  • "Value 2" (with code "val2")
  • "Value 3" (with code "val3")

Formula

COUNTDISTINCT(val1,val2,val3)

Results