Comparing two table and appending mismatches

Hi @Melissa

I am trying to compare two tables so I can isolate the items that do not appear on both tables. I have tried this
Table.AddColumn(#“Changed Type”,“InDates and InEmp”, each List.AllTrue({List.Contains(ListTkMasterEndDates,[EndDates]),List.Contains(ListtkEmployee,[Employee])})) to create a True or False but it does not seem to give me the results I want.

I have two table tkMasterEndDates and another table EMALLCompanyEndDates

I created 2 list of dates and employee from the tkMasterEndDates table and used the formula above to add a custom column to EMALLCompanyEndDates to give me a TRUE or FALSE but it is not given me the correct answer. So for example employee 127040 should be FALSE for the end dates 22/08/2021 00:00,29/08/2021 00:00, 05/09/2021 00:00 in EMALLCompanyEndDates but for some reason it gives me a TRUE

I have attached a file below
Comparing 2 tables Power Query.xlsx (95.6 KB)

Your help will be appreciated

Thanks

Hi @ambepat,

Sure, I’d be happy to take a look for you when I get back.

Hi @ambepat,

Give this a go instead, using Table.RemoveMatchingRows to identify the difference.
Note that record field names need to match for comparison so change either EndDate / EndDates

I hope this is helpful.

@Melissa thanks for this it is definitely what I was looking for but rather than just for employee 127040 I want a list of all employees that don’t match. When I try this I get a message below

@Melissa actually i did it with this
image
It seems to work but let me know if that is correct.

Hi @ambepat,

Correct, you only required the yellow accented part, the Table.SelectRows was only there to verify the result.

@Melissa What was the reason why this Table.AddColumn(#“Changed Type”,“InDates and InEmp”, each List.AllTrue({List.Contains(ListTkMasterEndDates,[EndDates]),List.Contains(ListtkEmployee,[Employee])})) didn’t work? I took it as a solution you gave me for another issued I had and it work then not sure why it didn’t work now?

But you have been great and helpful and I am really grateful.

Hi @ambepat,

Your query was different then, you only needed to know if a set of values was present in related tables but not if the full record matched with a record in another table - that’s what we’ve done here.

I hope this is helpful.

Ok Thanks

Hi @ambepat,

Don’t know if you’ve subscribed to the eDNA YouTube channel but the video covering this topic was released today. I’ll leave the link for you here. Hope you enjoy it.

1 Like

@Melissa lol. I clocked it when it appeared on my YouTube feed. I was like “I think I recognize those end dates”. But all good if it helps others I’m all for it. Do you have to do a video every week?

No certainly not, but I do take requests… LOL
When a topic comes through this (public) forum, I feel could benefit others, I make a note of that so I can do a video on it when I have the time.

Thanks for sharing @Melissa, this has made my day and will make my life easier at work.

2 Likes

What if the request is to do a video per week? :laughing:

Just asking…LOL

  • Brian

:thinking:
Sure… You guys bring the scenario’s and I’ll bring the solutions
LOL :nerd_face: