Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gambleave
Helper II
Helper 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. 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super 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"
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super 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"
    )
)

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thanks very much, this works fine. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors