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
Anonymous
Not applicable

Measure for Primary Key ID not found in Foreign Key table

Hello,

 

I'm trying to filter a measure to only show the IDs that are not found in a related table. 

 

What I have currently:

 

Closed Won Opportunites without Request =
     CALCULATE([Count of Closed Won Opportunities], NOT(Opportunity[OPPORTUNTIY_ID] IN 'Sales Engineering Request'))
 
Any help is very appreciated!
1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1672990216582.png

vjianbolimsft_1-1672990227211.png

Please try:

Measure = IF(NOT( MAX('Main Table'[Primary Key ID]) in SELECTCOLUMNS(ALL('Related Table'),"ID",[ID])),1)

Apply it to the visual:

vjianbolimsft_2-1672990385985.png

If you need a table:

Table = EXCEPT(VALUES('Main Table'[Primary Key ID]),VALUES('Related Table'[ID]))

Output:

vjianbolimsft_3-1672990508454.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on your description, I have created a simple sample:

vjianbolimsft_0-1672990216582.png

vjianbolimsft_1-1672990227211.png

Please try:

Measure = IF(NOT( MAX('Main Table'[Primary Key ID]) in SELECTCOLUMNS(ALL('Related Table'),"ID",[ID])),1)

Apply it to the visual:

vjianbolimsft_2-1672990385985.png

If you need a table:

Table = EXCEPT(VALUES('Main Table'[Primary Key ID]),VALUES('Related Table'[ID]))

Output:

vjianbolimsft_3-1672990508454.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

djurecicK2
Super User
Super User

Hi @Anonymous ,

 What is the result of the measure you've posted? You might need to change this section since I'm guessing that the ID field does not contain the text 'Sales Engineering Request'

NOT(Opportunity[OPPORTUNTIY_ID] IN 'Sales Engineering Request'

 

If the field you are looking for is a related table, you can get the value using RELATED:

https://learn.microsoft.com/en-us/dax/related-function-dax

https://dax.guide/related/

Please accept as solution if this answers the question- thanks!

 

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.