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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
dogburalHK82
Helper III
Helper III

merge two tables

Hi, 

 

I have two tables as below

 

Table 1

Part No.   202307    202308

AA11
BB11
CC11

 

Table 2

Part No.    202309   202310

AA11
DD11
EE11

 

Eventually, I would like to merge them and look like below

Part NO.   202307  202308      202309   202310

AA1111
BB11  
CC11  
DD  11
EE  11

 

When i merge them, I only managed to do like below

dogburalHK82_0-1692227769645.png

 

Even column merge, it appears like below

dogburalHK82_1-1692227802712.png

Please advise how I can achieve. 

 

Thanks

 

1 ACCEPTED SOLUTION
ronrsnfld
Super User
Super User

Instead of Joining, you can

  • Combine the two tables
  • Group by Part No.
  • Custom aggregation of each subgroup whereby you "fill up" the columns
    • Return only the first row of the table

 

let

//Change both Source lines to reflect the actual source of the two tables
    Source = Excel.CurrentWorkbook(){[Name="Table_1"]}[Content],
    Table1 = Table.TransformColumnTypes(Source,{{"Part No.", type text}, {"202307", Int64.Type}, {"202308", Int64.Type}}),

    Source2 = Excel.CurrentWorkbook(){[Name="Table_2"]}[Content],
    Table2 = Table.TransformColumnTypes(Source2,{{"Part No.", type text}, {"202309", Int64.Type}, {"202310", Int64.Type}}),

//Combine the two tables
    Combine = Table.Combine({Table1, Table2}),

//Then Group By Part No. and perform custom aggregation
    #"Grouped Rows" = Table.Group(Combine, {"Part No."}, {
        {"All", each Table.FillUp(_, Table.ColumnNames(_)){0}}}),

//Re-expand data and set the data types
    #"Expanded All" = Table.ExpandRecordColumn(#"Grouped Rows", "All", {"202307", "202308", "202309", "202310"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded All",{{"202307", Int64.Type}, {"202308", Int64.Type}, {"202309", Int64.Type}, {"202310", Int64.Type}})
in
    #"Changed Type"

 

 

Results

ronrsnfld_1-1692231902528.png

 

 

 

 

View solution in original post

2 REPLIES 2
dogburalHK82
Helper III
Helper III

@ronrsnfld Thank you very  much.

ronrsnfld
Super User
Super User

Instead of Joining, you can

  • Combine the two tables
  • Group by Part No.
  • Custom aggregation of each subgroup whereby you "fill up" the columns
    • Return only the first row of the table

 

let

//Change both Source lines to reflect the actual source of the two tables
    Source = Excel.CurrentWorkbook(){[Name="Table_1"]}[Content],
    Table1 = Table.TransformColumnTypes(Source,{{"Part No.", type text}, {"202307", Int64.Type}, {"202308", Int64.Type}}),

    Source2 = Excel.CurrentWorkbook(){[Name="Table_2"]}[Content],
    Table2 = Table.TransformColumnTypes(Source2,{{"Part No.", type text}, {"202309", Int64.Type}, {"202310", Int64.Type}}),

//Combine the two tables
    Combine = Table.Combine({Table1, Table2}),

//Then Group By Part No. and perform custom aggregation
    #"Grouped Rows" = Table.Group(Combine, {"Part No."}, {
        {"All", each Table.FillUp(_, Table.ColumnNames(_)){0}}}),

//Re-expand data and set the data types
    #"Expanded All" = Table.ExpandRecordColumn(#"Grouped Rows", "All", {"202307", "202308", "202309", "202310"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded All",{{"202307", Int64.Type}, {"202308", Int64.Type}, {"202309", Int64.Type}, {"202310", Int64.Type}})
in
    #"Changed Type"

 

 

Results

ronrsnfld_1-1692231902528.png

 

 

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Kudoed Authors