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
Goodkat
Helper II
Helper II

Merge / combine all columns of a table

Dear data enthusiasts,

 

Today I start building a new data model where in one process step I must merge all columns of the table. I did search the forum and the internet, but found only hints, which I tried to combine the right way, but I failed.

https://c.gmx.net/@324888734501700174/37A7kpkNTjuwYLy09Z8Gfg

In the attached example the recorded step is:

Merge = Table.CombineColumns(data,{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"merge") 

 

But as the number of columns can vary, I thought to bring in the Table.ColumnNames of the previous step:

Merge = Table.CombineColumns(data, {Record.SelectFields(Table.ColumnNames(data))}, Combiner.CombineTextByDelimiter(" ", QuoteStyle.None), "merge")

 

But it does not work. If I try without the Record.SelecFields it also fails.

Has anyone a conclusive idea, how to achieve the flexible merger of all columns? Any good hint?

Thank you!

 

Best regards, Andreas

1 ACCEPTED SOLUTION
Goodkat
Helper II
Helper II

Dear Power Query community,

 

I think with a night of sleep and proper thinking once again, I got it by myself:

If all columns shall be merged into one:

Merge = Table.CombineColumns(data, Table.ColumnNames(data), Combiner.CombineTextByDelimiter(" ", QuoteStyle.None), "merge")

If a merged column shall be added:

Add_Merge = Table.AddColumn(data, "cca", each Text.Combine(Record.FieldValues(Record.SelectFields(_, Table.ColumnNames(data))), " "), type text)

 

Best Regards, Andreas

View solution in original post

3 REPLIES 3
Goodkat
Helper II
Helper II

Dear Power Query community,

 

I think with a night of sleep and proper thinking once again, I got it by myself:

If all columns shall be merged into one:

Merge = Table.CombineColumns(data, Table.ColumnNames(data), Combiner.CombineTextByDelimiter(" ", QuoteStyle.None), "merge")

If a merged column shall be added:

Add_Merge = Table.AddColumn(data, "cca", each Text.Combine(Record.FieldValues(Record.SelectFields(_, Table.ColumnNames(data))), " "), type text)

 

Best Regards, Andreas

lbendlin
Super User
Super User

Your source file is not in a suitable format.  You need to unpivot the data there before your merge step.

 

What is the purpose of the merge?

Dear Ibendlin,

the source data format is correct. I cannot unpivot before as the purpose is the following: When I have the content of all columns merged into one, I will put a formula evaluating this merged column for certain key strings that give me an idea, if the row is the one showing the years, months, quarter or content. This information is needed for the following steps, which then also include an unpivot.

But the merge of all columns has to happen in the given format.

 

Best regards, Andreas

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