Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Count with DAX when specific value

Greetings,   I need help on how to count data when we have an specific value. Sorry in advance if this has been answered somewhere else, I tried several cases found here but none of them worked for...
  • Anonymous's avatar
    Anonymous
    3 years ago

    HI Anonymous ,

    You can create a variable with summarize function to aggregate records that has Code 'F' and group based on ‘Test Code’ and ‘FPcode’ categoried, and add custom fields to get correspond record count.

    formula =
    VAR summary =
        SUMMARIZE (
            FILTER ( ALLSELECTED ( Table ), [Fail_Pass_Code] = "F" ),
            [TestCode],
            [Fail_Pass_Code],
            "_Count", COUNTA ( Table[Fail_Pass_Code] )
        )
    RETURN
        SUMX ( summary, [_Count] )

    Regards,

    Xiaoxin Sheng