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
Tommyvhod
Helper II
Helper II

Distinc count filter from different table

Hello All

I would like to re-create a measure what seems to be working in one reporting but not working in mine.

 

The formula is:

 

CALCULATE(DISTINCTCOUNT(Data[ID]), 'Production Plan'[PNCode] = VALUES(Data[PNCode]) )
The Production plan and data tables are not connected they have a dimension table together.
 
I tried to trim, clean and lower case the PNCode colums, but nothing seems to help. ( it seems that the filter part is not OK)
 
The problem is that the same ID is appearing on multiple operations but I want to filter only those which are on the same opeartion what was planned
SO same ID on operation 1, 2, 3 above one department but in planning we have only operation 1
And i would like to filter from data only unique ID with operation one. ( now the result is 3 because 1 ID 3 operations)
 
Thank you
1 ACCEPTED SOLUTION
ValtteriN
Super User
Super User

Hi,

Here is an alternative approach:

Data:

table (9)

ValtteriN_0-1666855923990.png

table (10)

ValtteriN_1-1666855981457.png

Dax:

Measure 20 =


SUMX(DISTINCT(FILTER('Table (9)','Table (9)'[Dim2] in VALUES('Table (10)'[Dim2]))),'Table (9)'[Value])

End result:
ValtteriN_2-1666856289078.png

 

The result is 2 as expected since only values containing Dim2 = A1 are considered. This leaves 3 rows 2 of which are distinct.


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
Tommyvhod
Helper II
Helper II

Thank you. It is working.

ValtteriN
Super User
Super User

Hi,

Here is an alternative approach:

Data:

table (9)

ValtteriN_0-1666855923990.png

table (10)

ValtteriN_1-1666855981457.png

Dax:

Measure 20 =


SUMX(DISTINCT(FILTER('Table (9)','Table (9)'[Dim2] in VALUES('Table (10)'[Dim2]))),'Table (9)'[Value])

End result:
ValtteriN_2-1666856289078.png

 

The result is 2 as expected since only values containing Dim2 = A1 are considered. This leaves 3 rows 2 of which are distinct.


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





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

Proud to be a Super User!




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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.