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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Redzero1
Frequent Visitor

Union function in Power Query

Hello,

I have a simple request for M Query experts :

 

I have 3 different Tables ( Table1 , Table2, Table3) with different structure for each of them 

Table1 (Sales , Amount , Date , region , phone) 

Table2 (sales , product, Trade_date, amount , color)

Table3( VAT , amount , sales , client , date , supervisor)

 

what I want to have is One New table with the commun fields Table (Sales, Date , Sales) aggregating all information .

 

I managed to use UNION function in DAX but I want to see if can do it in Power Query using Table.Combine but with selected columns something like the below :

= Table.Combine({#"Table1", #"Table2", #"Table3"}) 

 

thanks for your help 

1 ACCEPTED SOLUTION
mtayyab07
Frequent Visitor

Please try this code

let
    // Correct the column names and select common columns for Table1
    Table1_Modified = Table.SelectColumns(Table.RenameColumns(Table1, {{"Amount", "Amount"}, {"Date", "Date"}, {"Sales", "Sales"}}), {"Sales", "Date", "Amount"}),

    // Correct the column names and select common columns for Table2
    Table2_Modified = Table.SelectColumns(Table.RenameColumns(Table2, {{"amount", "Amount"}, {"Trade_date", "Date"}, {"sales", "Sales"}}), {"Sales", "Date", "Amount"}),

    // Correct the column names and select common columns for Table3
    Table3_Modified = Table.SelectColumns(Table.RenameColumns(Table3, {{"amount", "Amount"}, {"date", "Date"}, {"sales", "Sales"}}), {"Sales", "Date", "Amount"}),

    // Combine the tables
    CombinedTable = Table.Combine({Table1_Modified, Table2_Modified, Table3_Modified})
in
    CombinedTable

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Redzero1 

You can create a blank query and put the following code to advanced editor 

let
    SelectColumnfromTable1=Table.SelectColumns(Table1,{"Sales","Date","Amount"}),
    SelectColumnfromTable2=Table.SelectColumns(Table2,{"sales","Trade_date","amount"}),
    Renametable2=Table.RenameColumns(SelectColumnfromTable2,{{"sales", "Sales"},{"Trade_date","Date"},{"amount","Amount"}}),
    SelectColumnfromTable3=Table.SelectColumns(Table3,{"sales","date","amount"}),
    Renametable3=Table.RenameColumns(SelectColumnfromTable3,{{"sales", "Sales"},{"date","Date"},{"amount","Amount"}}),
    combinetables = Table.Combine({Renametable3, Renametable2,SelectColumnfromTable1})
in
     combinetables

 

Output

vxinruzhumsft_0-1706669731815.png

 

Best Regards!

Yolo Zhu

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

AbhinavJoshi
Responsive Resident
Responsive Resident

Hello @Redzero1 . You can use the append queries option in Power Query M. 

AbhinavJoshi_0-1706307491411.png

 

mtayyab07
Frequent Visitor

Please try this code

let
    // Correct the column names and select common columns for Table1
    Table1_Modified = Table.SelectColumns(Table.RenameColumns(Table1, {{"Amount", "Amount"}, {"Date", "Date"}, {"Sales", "Sales"}}), {"Sales", "Date", "Amount"}),

    // Correct the column names and select common columns for Table2
    Table2_Modified = Table.SelectColumns(Table.RenameColumns(Table2, {{"amount", "Amount"}, {"Trade_date", "Date"}, {"sales", "Sales"}}), {"Sales", "Date", "Amount"}),

    // Correct the column names and select common columns for Table3
    Table3_Modified = Table.SelectColumns(Table.RenameColumns(Table3, {{"amount", "Amount"}, {"date", "Date"}, {"sales", "Sales"}}), {"Sales", "Date", "Amount"}),

    // Combine the tables
    CombinedTable = Table.Combine({Table1_Modified, Table2_Modified, Table3_Modified})
in
    CombinedTable

Thanks worked perfectly 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.