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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Yumikang
Helper I
Helper I

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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