Forum Discussion
Sammy22
2 years agoHelper I
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 Number | Customer | Country | Count |
| 1a | John | UK | 4 |
| 2a | David | Mexico | 3 |
| 3a | Peter | Italy | 1 |
| 1b | John | Germany | 4 |
| 2b | David | France | 3 |
| 3b | Peter | Italy | 1 |
| 1c | John | UK | 4 |
| 2c | David | Egypt | 3 |
| 3c | Peter | Italy | 1 |
| 4a | John | Poland | 4 |
Sammy22 , Try using below mentioned DAX measure
Count = CALCULATE(DISTINCTCOUNT('Table'[Country]), ALLEXCEPT('Table', 'Table'[Customer]))
2 Replies
- bhanu_gautamSuper User
Sammy22 , Try using below mentioned DAX measure
Count = CALCULATE(DISTINCTCOUNT('Table'[Country]), ALLEXCEPT('Table', 'Table'[Customer]))
- Sammy22Helper I
Thank you! What if i want a date filter too with a date after 2022-01-02? bhanu_gautam ?