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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Ying_P
Helper I
Helper I

How to count rows that are related to another table?

Hi,

 

I have two tables and they are connected.

 

In Table A, Client ID is unique but in Table B it is not.

Now I want to count the number of rows in Table A that have client ID existed in Table B. I'd like to use "countrows" function instead of "distinctcount" for another calculation purpose. Does any one know how to do it?

 

Thanks a lot in advance!!

 

Capture.JPG

 

 

 

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @Ying_P,

 

You can create a measure below:

 

Measure = COUNTROWS(FILTER('Table A',CONTAINS('Table B',[Client ID],'Table A'[Client ID])))

 

q3.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
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

4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

Hi @Ying_P,

 

You can create a measure below:

 

Measure = COUNTROWS(FILTER('Table A',CONTAINS('Table B',[Client ID],'Table A'[Client ID])))

 

q3.PNG

 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

So what should we do if we wanted to return only certain values ​​from table B? For example, what should we do if we wanted to filter client IDs with Product Category ID = 'Kids Tops'?

Anonymous
Not applicable

So simple! Thank you. I added a + 0 at the end to avoid blank when there is no match.

Thank you very much,. It works perfectly!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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