Forum Discussion
MATRIX distinct
- 7 years ago
Technically the subtotals are correct in that they just do the distinctcount on all the weeks together - so for one customer code, it will never be more than one. If you want to count the number of weeks each customer appears, you'll have to calculate by week and add these:
SUMX(VALUES([Weeknumber]),CALCULATE(DISTINCTCOUNT([CustomerCode]))
)
(Add appropriate table names etc.)
- 7 years ago
Thanks, that did the trick but with this code it was a bit better and accurate
COUNTROWS(SUMMARIZE(customers,customers[Date],customers[customercode]))
Technically the subtotals are correct in that they just do the distinctcount on all the weeks together - so for one customer code, it will never be more than one. If you want to count the number of weeks each customer appears, you'll have to calculate by week and add these:
SUMX(VALUES([Weeknumber]),
CALCULATE(DISTINCTCOUNT([CustomerCode]))
)
(Add appropriate table names etc.)
- PowerKoen7 years agoFrequent Visitor
Thanks, that did the trick but with this code it was a bit better and accurate
COUNTROWS(SUMMARIZE(customers,customers[Date],customers[customercode]))