Forum Discussion
DAX Function for COUNTIF and/or CALCULATE
- 9 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
Hi,
I want to ask if on a table with the name Compl and how do you count the number of 100%?
example : 100%
100%
100%
0%
0%
the result is 5 100%,
If in Excel it uses COUNTIF, how about how to do it in power bi?
Thank You
Prajanto
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 |
- Anonymous6 years agoNot applicable
it is working, thank a lot~
- RossM5 years agoRegular Visitor
This worked for me, thank you!
- onursari20093 years agoFrequent Visitor
It Works, Thank you dude!