cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Snoek
Frequent Visitor

DAX measure for distinct count grouped by multiple columns from multiple tables

I'm struggeling to get the following measure.

My data is from multiple (related) tables:

 

Table1.ContractnumberTable2.CustomernumberTable3.ProductcategoryTable3.ProductVolume
A1X10kg
A1Y100kg
A1Z50kg
B1X10kg
B1Y10kg
B1Z50kg
C2X100kg
C2X100kg
C2X50kg

 

What function should I use to create a distinct count of the productvolume per contract, customer and productype like:

ContractnumberCustomernumberProductCategoryNumber of distinct productvolumes
A1X1
A1Y1
A1Z1
B1X1
B1Y1
B1Z1
C2X

2

Could anyone please point me into the right direction in terms of which DAX functions to use for this?

1 REPLY 1
Nathaniel_C
Super User
Super User

Hi @Snoek ,

Try this:
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

 

 

Test = CALCULATE(DISTINCTCOUNT('Table'[Table3.ProductVolume]),FILTER(ALLEXCEPT('Table','Table'[Table1.Contractnumber],'Table'[Table2.Customernumber],'Table'[Table3.Productcategory]),('Table'[Table3.ProductVolume] = 'Table'[Table3.ProductVolume])))

Distinct.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Vote for T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.

March Events 2023A

March 2023 Events

Find out more about the online and in person events happening in March!