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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Combining columns from different Tables but in same orders

Dear Community Members, 

 

Request your help with below query -

 

I have 14 tables with similar data and 5 columns per table

 

Example of two tables below:

 

Table 1

Cif IDName
1711None
6947Somoene
1276Noone
5645Anyone

 

Table 2

 

CRNName
2868Yum
6502dum
6498some
5362ton

 

I want to combine all the columns in order with each representing the subsequent value in a new table like below:

Cif IDName
1711None
6947Somoene
1276Noone
5645Anyone
2868Yum
6502dum
6498some
5362ton

 

 

PS - Please note that columns are not in exact order header wise hence cannot use Append query , also tried below function 

 

= Table.Combine({
Table.RenameColumns(
Table.SelectColumns(#"Table 1","CIF Id") ,{{"CIF Id","CIF ID"}})
,
Table.RenameColumns(
Table.SelectColumns(#"Table 2","CRN") ,{{"CRN","CIF ID"}})
,
Table.RenameColumns(
Table.SelectColumns(#"Table 1","Name") ,{{"Name","Name"}})
,
Table.RenameColumns(
Table.SelectColumns(#"Table 2","Name") ,{{"Name","Name"}})

})

 

But it give below result :

 

Cif IDName
1711null
6947null
1276null
5645null
2868null
6502null
6498null
5362null
nullNone
nullSomoene
nullNoone
nullAnyone
nullYum
nulldum
nullsome
nullton

 

Please help

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

This pattern should work:

let
    Source =
    Table.SelectColumns(
        Table.Combine(
            {
                Table.RenameColumns(Table1, {{"ID1", "ID_Output"}, {"Name1", "Name_Output"}}),
                Table.RenameColumns(Table2, {{"ID2", "ID_Output"}, {"Name2", "Name_Output"}}),
                Table.RenameColumns(Table3, {{"ID3", "ID_Output"}, {"Name3", "Name_Output"}})
            }
        ),
        {"ID_Output", "Name_Output"}
    )
in
    Source

Update the column names as appropriate for your situation.

View solution in original post

6 REPLIES 6
AlexisOlson
Super User
Super User

This pattern should work:

let
    Source =
    Table.SelectColumns(
        Table.Combine(
            {
                Table.RenameColumns(Table1, {{"ID1", "ID_Output"}, {"Name1", "Name_Output"}}),
                Table.RenameColumns(Table2, {{"ID2", "ID_Output"}, {"Name2", "Name_Output"}}),
                Table.RenameColumns(Table3, {{"ID3", "ID_Output"}, {"Name3", "Name_Output"}})
            }
        ),
        {"ID_Output", "Name_Output"}
    )
in
    Source

Update the column names as appropriate for your situation.

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
sorry, but I don't understand the requirement.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

ImkeF
Community Champion
Community Champion

Oh yes, sorry - my fault:

= Table.Combine({
Table.RenameColumns(
Table.SelectColumns(#"Table 1","CIF Id", "Name") ,{{"CIF Id","CIF ID"}})
,
Table.RenameColumns(
Table.SelectColumns(#"Table 2","CRN", "Name") ,{{"CRN","CIF ID"}})
})

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

I am troubling you..

so there are 14 tables, all dont have the header as "Name", so ultimately i have to convert the "Name" to "Name"

ImkeF
Community Champion
Community Champion

Hi @Anonymous ,
please try the following instead:

= Table.Combine({
Table.RenameColumns(
Table.SelectColumns(#"Table 1","CIF Id", "Name") ,{{"CIF Id","CIF ID", "Name"}})
,
Table.RenameColumns(
Table.SelectColumns(#"Table 2","CRN", "Name") ,{{"CRN","CIF ID", "Name"}})
})



Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

Hi,

 

It give below error:

 

We cannot convert the value "Name" to type Number.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors