Forum Discussion
Barokzi
Sep 03, 2021Copper Contributor
PowerQuery: Lookup if row exists in another query based on row from current query
So I want to add a logical column that says whether a row exists in another query based on values from the current row: In the example below, MC in line 2 is a query with a field named DefKey and Do...
Jeremy Norbury
Sep 03, 2021Brass Contributor
Just perform a Merge, choosing as many columns as you like to make a match. Expand the result and all the nulls are where it did not match.
Barokzi
Sep 03, 2021Copper Contributor
Thanks for the response.
I did try the Merge/Left Join, that looks promising, as I can aggregate the resulting table column to counts. I did have a bug where it kept re-reading the source files for each row of the "left" query, so I was trying this one which would have been perfect and simpler f it worked.
If this can't work, it just means I'll have to go back to the Merge option and see what was up with that as well.
Just really curious why this one is not finding a match. It "seems" syntactically and logically correct. 🙂
- SergeiBaklanSep 03, 2021Diamond Contributor
Perhaps you mean something like this
with
let Source = Excel.CurrentWorkbook(){[Name="Two"]}[Content], #"Added Custom" = Table.AddColumn(Source, "Custom", each List.Contains( One[X], [A])) in #"Added Custom"
- BarokziSep 03, 2021Copper ContributorThat. Except in my case One is another query. Did not think of it as a list so I will try and report back.
Thank you Sergei!- SergeiBaklanSep 04, 2021Diamond Contributor
Sorry, I only illustrated an idea, it was much faster to generate that sample than restore your tables structure from the script.