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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Find missing records between two tables

Hello all,

 

I have two different data sources in two different databases / languages.

What I want to do is use Powerbi to automate & find which records  are missing from database 2.

Database 1 will always contain all the records but database 2 will be missing records.

 

I have a attached a Pbix example here

 

the data looks like this:

 

database 1 - table: customers database 2 - table: clientcustomers
CustomerCustomerID CustomerCustomerID
Walmart1 Walmart1
Winco2 Winco2
Target3 Target3
Amazon4 Amazon4
Costco5 Costco5
Frenchs6   
Roses7   
Cash & Carry8   
Yokes9   
     

 

and my desired output would show:

 

Preferred Output (missing records from database 2)
CustomerCustomerID
Frenchs6
Roses7
Cash & Carry8
Yokes9

 

 

How can I accomplish this in Powerbi?

 

thank you!

1 ACCEPTED SOLUTION
edhans
Community Champion
Community Champion

Do an ANTI-JOIN in Power Query.

  1. Select the first table. You can create a reference to that table if you don't want to distrupt that table first.
  2. Select the Merge button on the Home Ribbon
  3. Configure the dialog box as below. My Database 1 Customers (2) is because I created a reference.

2020-04-21 15_17_36-.png

It returns this:

2020-04-21 15_18_05-example (1) - Power Query Editor.png

 

If you want to see the M code doing this, create a blank query and put this code in:

1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done

let
    Source = #"Database 1 - Customers",
    #"Merged Queries" = Table.NestedJoin(Source, {"CustomerID"}, #"database 2 - clientcustomers", {"CustomerID"}, "database 2 - clientcustomers", JoinKind.LeftAnti),
    #"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"database 2 - clientcustomers"})
in
    #"Removed Columns"


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
edhans
Community Champion
Community Champion

Do an ANTI-JOIN in Power Query.

  1. Select the first table. You can create a reference to that table if you don't want to distrupt that table first.
  2. Select the Merge button on the Home Ribbon
  3. Configure the dialog box as below. My Database 1 Customers (2) is because I created a reference.

2020-04-21 15_17_36-.png

It returns this:

2020-04-21 15_18_05-example (1) - Power Query Editor.png

 

If you want to see the M code doing this, create a blank query and put this code in:

1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done

let
    Source = #"Database 1 - Customers",
    #"Merged Queries" = Table.NestedJoin(Source, {"CustomerID"}, #"database 2 - clientcustomers", {"CustomerID"}, "database 2 - clientcustomers", JoinKind.LeftAnti),
    #"Removed Columns" = Table.RemoveColumns(#"Merged Queries",{"database 2 - clientcustomers"})
in
    #"Removed Columns"


Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

thank you for the quick response!!!! I will try later tonight and follow up if I have anymore questions. 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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