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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
viferenc
Helper II
Helper II

Table.CombineColumns - Query Editor

Dear All, 

 

I tried to solve my problem by myself but it did not work.

 

I would need your help in the follwoing topic.

 

In the Query Editor I have 3 different tables, with different strucutre. 

 

I would like to combine from these 3 tables only specific columns in a new table.

 

This I would like to do already in the Query Editor and not outside query editor with union and selectedcolumns.

 

Could you please help me how does it work in query editor?

 

Thank you very much for your help.

 

Br

 

Feri

 

 

Could you please give 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi

As you said, you want to combine from these 3 tables only specific columns in a new table but to do it in the Query Editor instead of using DAX function “ union and selectedcolumns”.

 

Here is a simple example to do this.

 

Select the first two columns from each table of the three tables(eg. From excel)  and add them into a new table.

 

76.pngTable1

77.pngTable2

78.pngTable3

81.png

80.pngNew Table

 

In query editor, New Source>Blank Query, code in advanced editor,

 

let
    Source1 = Table1,
    Source2 = Table2,
    Source3 = Table3,
    AppendColumns1=Table.SelectColumns(Source1, {"columnA","columnB"}),
    AppendColumns2=Table.SelectColumns(Source2, {"columnC","columnD"}),
    AppendColumns3=Table.SelectColumns(Source3, {"columnE","columnF"}),
    RenameAppendColumns2 = Table.RenameColumns(AppendColumns2,{{"columnC", "columnA"}, {"columnD", "columnB"}}),
    RenameAppendColumns3 = Table.RenameColumns(AppendColumns3,{{"columnE", "columnA"}, {"columnF", "columnB"}}), 
    #"Appended Query1" = Table.Combine({AppendColumns1, RenameAppendColumns2}),
    #"Appended Query2" = Table.Combine({#"Appended Query1", RenameAppendColumns3})
in
    #"Appended Query2"

 

Best Regards

Maggie

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi

As you said, you want to combine from these 3 tables only specific columns in a new table but to do it in the Query Editor instead of using DAX function “ union and selectedcolumns”.

 

Here is a simple example to do this.

 

Select the first two columns from each table of the three tables(eg. From excel)  and add them into a new table.

 

76.pngTable1

77.pngTable2

78.pngTable3

81.png

80.pngNew Table

 

In query editor, New Source>Blank Query, code in advanced editor,

 

let
    Source1 = Table1,
    Source2 = Table2,
    Source3 = Table3,
    AppendColumns1=Table.SelectColumns(Source1, {"columnA","columnB"}),
    AppendColumns2=Table.SelectColumns(Source2, {"columnC","columnD"}),
    AppendColumns3=Table.SelectColumns(Source3, {"columnE","columnF"}),
    RenameAppendColumns2 = Table.RenameColumns(AppendColumns2,{{"columnC", "columnA"}, {"columnD", "columnB"}}),
    RenameAppendColumns3 = Table.RenameColumns(AppendColumns3,{{"columnE", "columnA"}, {"columnF", "columnB"}}), 
    #"Appended Query1" = Table.Combine({AppendColumns1, RenameAppendColumns2}),
    #"Appended Query2" = Table.Combine({#"Appended Query1", RenameAppendColumns3})
in
    #"Appended Query2"

 

Best Regards

Maggie

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.