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
PQRookie
Frequent Visitor

Power Query amend a table with rows from another one based on conditions,

Hi, quite new to PQ and wonder if I can get some help on this one?

I need a new table with all rows from Table1 and all rows from Table2 with IDs that exist in Table1.
Should then look as Table3.

 

Thanks in advance!

 

image.png image.png image.png

 

2 ACCEPTED SOLUTIONS
dufoq3
Super User
Super User

Hi @PQRookie, for future requests, provide sample data in usable format (as table), so we can copy/paste. If you don't know how to do it, read my note below.

 

let
    Table1 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtE3MAQiJR2lRCA2VIrVwSJshF3YGFXYCCiUBMQm2IVNsQubKcXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, ID = _t, Val = _t]),
    Table2 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA3MNM3NFDSUUoEYiAjVgdNPAkkbogpngwSN8IUB5tjjCJuZAozxwRTHGyOKaY42BwzHOaY4zDHAoc5lijixjB/GRlgioPMMQL6NxYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, ID = _t, Val = _t]),
    // Filterd only IDs from Table1
    Table2Filtered = Table.SelectRows(Table2, each List.Contains(List.Distinct(Table1[ID]), [ID])),
    Appended = Table.Combine({Table1, Table2Filtered})
in
    Appended

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

PQRookie
Frequent Visitor

Thanks a lot, works fine, much appreciated!

And also, thanks for guidance on usable data.

View solution in original post

3 REPLIES 3
PQRookie
Frequent Visitor

Thanks a lot, works fine, much appreciated!

And also, thanks for guidance on usable data.

You're welcome. Just one remark: you should mark as solution post with solution 😉


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

dufoq3
Super User
Super User

Hi @PQRookie, for future requests, provide sample data in usable format (as table), so we can copy/paste. If you don't know how to do it, read my note below.

 

let
    Table1 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtE3MAQiJR2lRCA2VIrVwSJshF3YGFXYCCiUBMQm2IVNsQubKcXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, ID = _t, Val = _t]),
    Table2 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA3MNM3NFDSUUoEYiAjVgdNPAkkbogpngwSN8IUB5tjjCJuZAozxwRTHGyOKaY42BwzHOaY4zDHAoc5lijixjB/GRlgioPMMQL6NxYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, ID = _t, Val = _t]),
    // Filterd only IDs from Table1
    Table2Filtered = Table.SelectRows(Table2, each List.Contains(List.Distinct(Table1[ID]), [ID])),
    Appended = Table.Combine({Table1, Table2Filtered})
in
    Appended

Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.