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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
pbisandie
Regular Visitor

Count of rows where criteria is met in related table

Hi, I'm looking to create a measure for the sample data set below. There is a one-to-many relationship on the Parent ID.

 

I want to count the number of parent IDs with the name Karen who have a female (F) child named Alex. The result I'm looking for woudl be 1. 

 

Any help is much appreciated. Thanks!

 

Parent Table

Parent IDParent Name
1Bob
2Karen
3Jason
4Karen

 

Parent-Child Table

Parent IDParent NameChild NameChild Sex
1BobAmyF
1BobKelsieF
2KarenRandyM
2KarenTimmyM
2KarenAlexM
3JasonAaronM
4KarenAlexF
4KarenDollyF

 

 

 

 

1 ACCEPTED SOLUTION
Bibiano_Geraldo
Super User
Super User

Hi, @pbisandie!

Please try the following DAX to create your measure:

CountKarenWithFemaleAlex = 
CALCULATE(
    DISTINCTCOUNT('Parent Table'[Parent ID]),
    'Parent Table'[Parent Name] = "Karen",
    FILTER(
        'Parent-Child Table',
        'Parent-Child Table'[Child Name] = "Alex" &&
        'Parent-Child Table'[Child Sex] = "F"
    )
)

 

Make sure to replace column and tables names with your owns.

 

If this answer satisfies your needs, please consider to mark it as solution and give a Kudo.

 

Thank you

View solution in original post

1 REPLY 1
Bibiano_Geraldo
Super User
Super User

Hi, @pbisandie!

Please try the following DAX to create your measure:

CountKarenWithFemaleAlex = 
CALCULATE(
    DISTINCTCOUNT('Parent Table'[Parent ID]),
    'Parent Table'[Parent Name] = "Karen",
    FILTER(
        'Parent-Child Table',
        'Parent-Child Table'[Child Name] = "Alex" &&
        'Parent-Child Table'[Child Sex] = "F"
    )
)

 

Make sure to replace column and tables names with your owns.

 

If this answer satisfies your needs, please consider to mark it as solution and give a Kudo.

 

Thank you

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors