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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
adam_macs
Helper I
Helper I

Count of Subcategory Rows related to another table

Hi, I have 2 tables that are connected via the Customer ID.

 

My aim is to have a distinct count of the total customers within a given subcategory of Table B if one or more customers from Table A are found within that subcategory.

 

This would tell me how much of the market we have penetrated. For example, we sell road bikes to Jon Yang which is 1 out of a possible 6 customers within the road bike category.

 

So essentially, if we have customers from Table A in Table B, what is the total number of customers within the subcategories they exist in.

 

Any help much appreciated.

 

adam_macs_1-1660560795748.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @adam_macs ,

 

I do the test and this is my data of two tables:

vmengzhumsft_1-1660811024283.png

I got this result through my testing:

vmengzhumsft_0-1660810728137.png

and through filtering, you can get the count of rows related to each subcategory.

for example, I choose Bike , it get the correct result:

vmengzhumsft_2-1660811068568.png

so if this result can meets your needs, you can try this measure:

 

Measure = COUNTROWS(FILTER('Table 1','Table 1'[customer id] in VALUES('Table 2'[customer id])))

 

 

Best regards,

Community Support Team Selina zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @adam_macs ,

 

I do the test and this is my data of two tables:

vmengzhumsft_1-1660811024283.png

I got this result through my testing:

vmengzhumsft_0-1660810728137.png

and through filtering, you can get the count of rows related to each subcategory.

for example, I choose Bike , it get the correct result:

vmengzhumsft_2-1660811068568.png

so if this result can meets your needs, you can try this measure:

 

Measure = COUNTROWS(FILTER('Table 1','Table 1'[customer id] in VALUES('Table 2'[customer id])))

 

 

Best regards,

Community Support Team Selina zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

jplouw1
New Member

Please share a screenshot of your Data model

Capture.PNG

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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