Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Count repeated

Good afternoon, I have a table with DATE, MONTH, NO CONTAINER (alphanumeric). I need to calculate the total containers per month. According to the text, January has 10 records and I need the answer ...
  • MFelix's avatar
    MFelix
    7 years ago

    Hi Anonymous,

     

    When you make a measure the calculations for total are make based on context so when you are in the totals you are calculating the distinct count of the full data set for january so if NO CONTAINER has only 3 values the total will return 3 you need to make this measure:

     

    Total Containers =
    IF (
        HASONEFILTER ( Table[Cliente] );
        DISTINCTCOUNT ( Table[NO CONTAINER] );
        SUMX ( ALL ( Table[Cliente] ); DISTINCTCOUNT ( Table[NO CONTAINER] ) )
    )

    Regards,

    MFelix