Find rows in lookup table that don't match any row in the data table

unire

New Member
Joined
Jul 29, 2016
Messages
3
What's the best way (preferably with DAX query functions, such as SUMMARIZE, GENERATE, etc) to find all the rows in a lookup table that have no matching row in the data table?

For example, with a data table like this:

Person ID
Country Key
Age
581
1
25
492
1
48
390
2
37
410
2
29
173
2
61

<tbody>
</tbody>

And this lookup table:

Country Key
Country Name
1
United Kingdom
2
Japan
3
China

<tbody>
</tbody>

The query would need to return one row (3 - China).
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I think I figured it out.
To get all the rows in the lookup table that don't match any row in the data table, I'm doing this:

EVALUATE
FILTER(
DimCountries,
COUNTROWS(RELATEDTABLE(FactPeople)) = 0
)

And to do the other way around (data rows that don't match a lookup row):

EVALUATE
FILTER(
FactPeople,
RELATED(DimCountries[Country Key]) = BLANK()
)

But I don't know whether there are more efficient solutions.
 
Upvote 0

Forum statistics

Threads
1,215,978
Messages
6,128,063
Members
449,416
Latest member
SHIVANISHARMA1711

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top