DISTINCTCOUNT Function (DAX)

How does the DISTINCTCOUNT function (DAX) work?

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

DISTINCTCOUNT Formula Syntax

DISTINCTCOUNT(
     <column>
)

How do you use the DISTINCTCOUNT function?

The DISTINCTCOUNT function is used to disregard duplicated customer IDs, so it counts the number of individual customers that each product has.

Related Blog Posts

Related Support Forum Posts

Iterating a distinctcount between two tables
Wrong values in table
Distinct count for events generated by the same customers

Considerations when using the DISTINCTCOUNT function

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.

DISTINCTCOUNT function includes the BLANK value. To skip the BLANK value, use the DISTINCTCOUNTNOBLANK function.

Related Video Tutorials

Formula examples using the DISTINCTCOUNT function

=DISTINCTCOUNT(ResellerSales_USD[SalesOrderNumber]) “`dax 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 count|Column Labels|||||| |-|-|-|-|-|-|-| |Row Labels|Accessories|Bikes|Clothing|Components||Grand Total| |2005|135|345|242|205||366| |2006|356|850|644|702||1015| |2007|531|1234|963|1138||1521| |2008|293|724|561|601||894| ||||||1|1| |Grand Total|1315|3153|2410|2646|1|3797| 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.

= DISTINCTCOUNT (Sales[Account])

= CALCULATE(DISTINCTCOUNT(‘Net Revenue Data'[Publisher Name]),FILTER(‘Net Revenue Data’,’Net Revenue Data'[Active Month]=1))

Related DAX Functions

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI
Center of Excellence

DOWNLOAD


Download our comprehensive DAX Formula Reference Guide as perfect companion as you learn how to use DAX formulas within Power BI.


Download DAX Formulas Reference Guide
Download DAX Formula Reference Guide
Membership