Table of contents
TOC
Collapse the table of content
Expand the table of content

DISTINCTCOUNT Function (DAX)

Owen Duncan|Last Updated: 4/19/2018

The DISTINCTCOUNT function counts the number of distinct values in a column.

Syntax

DISTINCTCOUNT(<column>)  

Parameters

TermDescription
columnThe column that contains the values to be counted

Return Value

The number of distinct values in column.

Remarks

The only argument allowed to this function is a column. You can use columns containing any type of data. When the function finds no rows to count, it returns a BLANK, otherwise it returns the count of distinct values.

Example

The following example shows how to count the number of distinct sales orders in the column ResellerSales_USD[SalesOrderNumber].

=DISTINCTCOUNT(ResellerSales_USD[SalesOrderNumber])  

Using the above measure in a table with calendar year in the side and product category on top gives the following results:

Distinct Reseller Orders countColumn Labels
Row LabelsAccessoriesBikesClothingComponentsGrand Total
2005135345242205366
20063568506447021015
2007531123496311381521
2008293724561601894
11
Grand Total131531532410264613797

In the above example, note that the rows Grand Total numbers do not add up, this happens because the same order might contain line items, in the same order, from different product categories.

See Also

COUNT Function (DAX)
COUNTA Function (DAX)
COUNTAX Function (DAX)
COUNTX Function (DAX)
Statistical Functions (DAX)

© 2018 Microsoft