Forum Discussion

deeave's avatar
deeave
Helper I
2 years ago
Solved

Merging Several Columns from 2 Different Tables to 1 Table

In my report, I would like one table that shows the title and status.  Data comes from two different tables.  When I attempt to use Merge Queries into new and select title in both tables, it brings o...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi,

    Thanks for the solution asadmd93  offered, and i want to offer some more information for user to refer to.

    hello deeave , if you want to the same columns in two tables, you can refer to the follwing sample.

    Sample data 

    Table A

    Table B

    Create a blank query, then input the following code in advanced editor.

    let
        Columnname=List.Intersect({Table.ColumnNames(#"Table A"),Table.ColumnNames(#"Table B")}),
        Source1=Table.SelectColumns(#"Table A",Columnname),
        Source2=Table.SelectColumns(#"Table B",Columnname),
        Combine=Table.Combine({Source1, Source2})
    in
        Combine

    Output

    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.