Forum Discussion
ksobota
10 years agoRegular Visitor
DAX Function for COUNTIF and/or CALCULATE
Hello, I am fairly new to Power BI and am even newer to the use of DAX functions. For years I have worked in Excel and know how I would do this there, but am finding the same formula I would use ...
- 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
wonga
Continued Contributor
10 years agoksobota Not too sure if this would be the right way to go about it without some sample data to work with. There should be a many to one relationship between EMPLOYMENTS and INDIVIDUALS. As for the DAX formula, maybe something like:
UserIDMatchCount =
CALCULATE
(
COUNT(EMPLOYMENTS[UserID]),
EMPLOYMENTS[UserID] = INDIVIDUAL[UserID]
)Sieiro1
Microsoft Employee
6 years agoWorks like a charm!
I replaced the last part:
INDIVIDUAL[UserID]
with "Text" , and made it into a measure. Just what I needed.
Thanks so much!