Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Countx with some conditions

Hello!! Im trying to do this in a calculated column in dax, im not sure where is the mistake.   I have a table with information like this:   I want to count by country, supplier and mat_grou...
  • PattemManohar's avatar
    PattemManohar
    7 years ago

    Anonymous Please try below using "New Column"

     

    ActualCount = CALCULATE(COUNTROWS(MatGroups),ALLEXCEPT(MatGroups,MatGroups[Country],MatGroups[Supplier]))
    ExpectCount = CALCULATE(DISTINCTCOUNT(MatGroups[MatGroup]),ALLEXCEPT(MatGroups,MatGroups[Country],MatGroups[Supplier]))

     

    Note - You can solve the same in "Power Query" as well using "GROUP BY" option..

     

    Hope this helps !!