Forum Discussion

Sammy22's avatar
Sammy22
Helper I
2 years ago
Solved

Countifs function with unique element

Hello,

 

I am trying to calculate the 'count' column in pBI but am struggling. I need to count the unique number of countries each customer is assigned to, for example John has 4, peter has 1 (Italy).

 

Order NumberCustomerCountryCount
1aJohnUK4
2aDavidMexico3
3aPeterItaly1
1bJohnGermany4
2bDavidFrance3
3bPeterItaly1
1cJohnUK4
2cDavidEgypt3
3cPeterItaly1
4aJohnPoland4
  • Sammy22 , Try using below mentioned DAX measure

     

    Count = CALCULATE(DISTINCTCOUNT('Table'[Country]), ALLEXCEPT('Table', 'Table'[Customer]))

2 Replies

  • Sammy22 , Try using below mentioned DAX measure

     

    Count = CALCULATE(DISTINCTCOUNT('Table'[Country]), ALLEXCEPT('Table', 'Table'[Customer]))