OpenBI Docs Buy

DISTINCTCOUNT

How many different values a column holds; a blank, if there is one, is one of them.

Group: Aggregation. Compatible with DAX.

Syntax

DISTINCTCOUNT ( <column> )
ParameterTypeDescription
columnColumnThe column whose different values are counted.

Returns

Whole number. How many different values the column has in the current filter context.

Remarks

  • A blank is counted as one more value when the column has any; DISTINCTCOUNTNOBLANK leaves it out.
  • It equals COUNTROWS ( VALUES ( column ) ), which also counts a blank row.
  • When no row is left in the filter context, the result is BLANK.

Examples

Shops and products

EVALUATE
ROW (
    "Shops", DISTINCTCOUNT ( Sales[Shop] ),
    "Products", DISTINCTCOUNT ( Sales[Product] )
)
ShopsProducts
154

The blank is one of the values

Three different prices and a blank: four values. Without the blank: three.

EVALUATE
ROW (
    "DISTINCTCOUNT", DISTINCTCOUNT ( Holdings[Price] ),
    "DISTINCTCOUNTNOBLANK", DISTINCTCOUNTNOBLANK ( Holdings[Price] )
)
DISTINCTCOUNTDISTINCTCOUNTNOBLANK
43

DISTINCTCOUNTNOBLANK, APPROXIMATEDISTINCTCOUNT, VALUES, DISTINCT, COUNTROWS.

Last updated · OpenBI Studio 0.3.74