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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Panta
New Member

DAX measure - Distinct count referencing second table

I have two tables in my model: Sales table and Products table.

 

Sales table contains columns: Year; Customer_name; Product_Name; Sales_Amount.
Product table contains columns: Product_Name; Brand_Name

 

I need to create two measures to show:

1. Count of distinct products purchased by a customer in a given year
2. Count of distinct Brands purchased by a customer in a given year.

 

I did task 1 with the following function:
ProductCount_2020 = CALCULATE(DISTINCTCOUNTNOBLANK(Sales[Product_Name]); 'Calendar'[Year] = 2020)

 

I need help for the second task: how to get the count of distinct brands purchased by a customer on the basis of distinct products purchased? (i.e. how to reference the second table that relates products to theri brands?)

 

Thank you

1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

HI @Panta ,

 

Please see if this video helps

https://www.youtube.com/watch?v=KeapGs-VTYI

 

 

https://community.powerbi.com/t5/Desktop/Related-Distinct-Count/m-p/362302

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

 

View solution in original post

2 REPLIES 2
Panta
New Member

Thank you.

1. The YT video did not help - it is just an elementary exposition of the Distinctcount function

2. The other post you shared did the job and helped me complete my task correctly.

 

Thaks a lot!

harshnathani
Community Champion
Community Champion

HI @Panta ,

 

Please see if this video helps

https://www.youtube.com/watch?v=KeapGs-VTYI

 

 

https://community.powerbi.com/t5/Desktop/Related-Distinct-Count/m-p/362302

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.