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
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
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.