Forum Discussion
gambleave
3 years agoHelper II
Countrows based on distinct field
Hi, I have the below measure to count the number of records in the table "Employee Vote" where
the Role is indicated as Sales and the Region is Europe.
Count Europe Sales Votes =
CALCULATE(COUNTROWS('Employee Vote'), FILTER(FILTER('Employee Vote', Employee Vote[Role]="Sales"), 'Employee Vote'[Region]="Europe"))
Additionally, I would like to count only distinct records by an "Employee Name" column in the same table. How can I modify the syntax to achieve this? Thank you.
Hi,
Please try the below whether it suits your requirement.
Count Europe Sales Name = CALCULATE ( COUNTROWS ( DISTINCT ( 'Employee Vote'[Employee Name] ) ), FILTER ( 'Employee Vote', 'Employee Vote'[Role] = "Sales" && 'Employee Vote'[Region] = "Europe" ) )
2 Replies
- Jihwan_KimSuper User
Hi,
Please try the below whether it suits your requirement.
Count Europe Sales Name = CALCULATE ( COUNTROWS ( DISTINCT ( 'Employee Vote'[Employee Name] ) ), FILTER ( 'Employee Vote', 'Employee Vote'[Role] = "Sales" && 'Employee Vote'[Region] = "Europe" ) )- gambleaveHelper II
Thanks very much, this works fine.