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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Learner27
Helper III
Helper III

Append two tables based on the conditions

Hi Everyone.

I have two tables, and I need to append them based on a condition: where table 1 column 1 is not in table 2 column 2


Table 1

Column1 Column2

ABC             1
ABC             2
BCA             3
CZA             4

Table 2

Column1 Column2

ABC            1
BCA            2
ABC            3

Expected Output (after appending both tables):

Column1 Column2

CZA            4

Please provide me with the Power Query steps to achieve this."

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Learner27 ,

 

I suggest you to try code as below in Power Query Editor.

let
    Source = Table.Combine({#"Table 1", #"Table 2"}),
    #"Filtered Rows" = 
    let 
    _Query = 
    Table.ToList( Table.SelectColumns(Table.NestedJoin(#"Table 1", {"Column1"}, #"Table 2", {"Column1"}, "Table 2", JoinKind.Inner),"Column1"),Combiner.CombineTextByDelimiter(","))
    in
    Table.SelectRows(Source, each not(List.Contains(_Query, [Column1])))
in
    #"Filtered Rows"

New Table:

vrzhoumsft_0-1698141479316.png

 

Best Regards,
Rico Zhou

 

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

Hi @Learner27 ,

 

I suggest you to try code as below in Power Query Editor.

let
    Source = Table.Combine({#"Table 1", #"Table 2"}),
    #"Filtered Rows" = 
    let 
    _Query = 
    Table.ToList( Table.SelectColumns(Table.NestedJoin(#"Table 1", {"Column1"}, #"Table 2", {"Column1"}, "Table 2", JoinKind.Inner),"Column1"),Combiner.CombineTextByDelimiter(","))
    in
    Table.SelectRows(Source, each not(List.Contains(_Query, [Column1])))
in
    #"Filtered Rows"

New Table:

vrzhoumsft_0-1698141479316.png

 

Best Regards,
Rico Zhou

 

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

 

OwenAuger
Super User
Super User

Hi @Learner27 

  • Could you clarify the logic?
  • Should the condition be Table 1 Column 1 is not in Table 2 Column 1?
  • Also, in your example, the expected output includes only a row from Table 1. Could you give an example where the output would include rows from Table 2 (to help clarify the logic)?

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.