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

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

Reply
Yumikang
Helper II
Helper II

How do I count the unique values in Table A that contain Table B?

Dear all,

I desperately need help.

I have two tables in my model in power BI, Table A and Table B.

Table B has unique values.The two tables already have a “one-to-many” relationship in the model.

How do you count the unique quantity of a type A that contains B?

Thank you so much

 

Yumikang_0-1730886869180.png

 

1 ACCEPTED SOLUTION
xifeng_L
Super User
Super User

Hi @Yumikang , You can try below measure:

 

Unique Count = CALCULATE(DISTINCTCOUNT(SheetA[Key Field]),SheetB[Key Field]<>BLANK())

 

View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

@Yumikang 

 

Download PBIX file with the example shown below

 

The tables are linked together by a relationship on a column, let's call it RelCol.

 

PhilipTreacy_0-1730888183273.png

 

 

In a Table visual add RelCol from Table B, then add the column from Table A that you want the unique count of and choose the aggregation Count (Distinct).

 

PhilipTreacy_2-1730888291282.png

 

 

In my example I want the distinct count of Column1

 

PhilipTreacy_1-1730888250670.png

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


xifeng_L
Super User
Super User

Hi @Yumikang , You can try below measure:

 

Unique Count = CALCULATE(DISTINCTCOUNT(SheetA[Key Field]),SheetB[Key Field]<>BLANK())

 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.