Forum Discussion
DAX Function for COUNTIF and/or CALCULATE
- 10 years ago
Hi ksobota,
Based on your scenario, you can use the DAX below on your INDIVIDUAL table.
CountUser = CALCULATE(COUNTA(EMPLOYMENTS[Member_C]),FILTER(ALL(EMPLOYMENTS),EMPLOYMENTS[Member_C]=INDIVIDUAL[User_ID]))
Regards,
Charlie Liao
I was able to accomplish this through variables.
For example I wanted to count the times an employee name appeared in my employee name column, since each row is unique to the entire column i stored this value as a var in Formual Bar.
This will work just like a Count If based on the current value of the Row.
Column Name =
var emplaoyee_name = Table[Employee Name]
var Outcome = CALCULATE(COUNT(Table[Employee Name]),FILTER(Table,Table[Employee Name]= employee_name))
Return
Outcome
The above code will produce the count output in the below table:
| Employee Name | Count |
| A | 3 |
| A | 3 |
| A | 3 |
| B | 2 |
| B | 2 |
| C | 1 |
it is working, thank a lot~