Counts distinct values in the column.
| Field | Value |
|---|---|
| Category | Statistics |
| Type | Aggregation (operates on a set of rows) |
| Arity | 1 argument (fixed) |
| Compiles to SQL (calculated column) | Yes |
| Version | Formula engine v3. |
Aliases#
Canonical name: CONTD. Accepted aliases (case-insensitive): distinctcount, countd.
Syntax#
code
CONTD(coluna)The 1st argument is the name of a column (bare identifier); the others are expressions.
Returns#
Number (count of distinct values).
Null handling#
Blank is not counted as a distinct value.
Evaluation context#
Aggregation — goes through the rows of the visual's current group.
Differences from DAX#
- DAX equivalent: DISTINCTCOUNT
- Compatibility: DIFFERS from DAX — different semantics, watch out
- Note: Counts distinct values, but BLANK IS NOT counted — DAX DISTINCTCOUNT counts BLANK as one extra value when it exists.
Examples#
code
CONTD(pedido)Example with values#
Input: uf = SP, SP, RJ.
code
CONTD(uf) → 2Expected result: 2
Business example#
Number of distinct customers who bought in the period.
Common errors#
Typos in a column name, an incompatible type, or an invalid argument become a friendly message (pt-BR) — the engine never silently returns a wrong number.