Forum Discussion

PowerKoen's avatar
PowerKoen
Frequent Visitor
7 years ago
Solved

MATRIX distinct

Hello, I have the following colomn in a table: -Date -Name -CustomerCode -Weeknumber I made a MATRIX, with rows CustomerCode, and value (distinctcount of customercode)             ...
  • Michiel's avatar
    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.)

  • PowerKoen's avatar
    PowerKoen
    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]))