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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Join tables

Hi!

 

I hace two tables with different number of columns but they share several columns.

Table A

TA.JPG

Table B

TB.JPG

 

Both tables have column "type".

I need to join both tables to include for each client the rows from table B of the same "type" that are not in table A.

This must be the result:

TR.JPG

 

Any help?

Thanks a lot!

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Table A

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjZU0lFyBGJfEMPQQClWB1nQCEnQCCZojE0QpjIWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [CUSTOMER = _t, TYPE = _t, MATERIAL = _t, NET = _t])
in
    Source

Table B

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUfI1VIrVgTKNEExjpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [TYPE = _t, MATERIAL = _t]),
    #"Added Custom" = Table.AddColumn(Source, "CUSTOMER", each List.Distinct(#"Table A"[CUSTOMER])),
    #"Expanded Customer" = Table.ExpandListColumn(#"Added Custom", "CUSTOMER")
in
    #"Expanded Customer"

Merge Table

let
    Source = #"Table A" & #"Table B",
    #"Removed Duplicates" = Table.Distinct(Source, {"CUSTOMER", "TYPE", "MATERIAL"})
in
    #"Removed Duplicates"

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

Table A

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjZU0lFyBGJfEMPQQClWB1nQCEnQCCZojE0QpjIWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [CUSTOMER = _t, TYPE = _t, MATERIAL = _t, NET = _t])
in
    Source

Table B

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUfI1VIrVgTKNEExjpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [TYPE = _t, MATERIAL = _t]),
    #"Added Custom" = Table.AddColumn(Source, "CUSTOMER", each List.Distinct(#"Table A"[CUSTOMER])),
    #"Expanded Customer" = Table.ExpandListColumn(#"Added Custom", "CUSTOMER")
in
    #"Expanded Customer"

Merge Table

let
    Source = #"Table A" & #"Table B",
    #"Removed Duplicates" = Table.Distinct(Source, {"CUSTOMER", "TYPE", "MATERIAL"})
in
    #"Removed Duplicates"

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.