DISTINCTCOUNT Function (DAX)
The DISTINCTCOUNT function counts the number of different cells in a column of numbers.
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 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 the user should be able to 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.
