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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Mic1979
Post Partisan
Post Partisan

Test.Combine with List

Dear all,

 

I have a table with a lot of culumns, and I want to combine them in a dymamic way.

 

I am using then the following instructions:

 

Dollars_Columns_Selected_DOLLAR_Source1 = List.Select(Table.ColumnNames(Total_Sales_DOLLARS_New_Name_Source1), each Text.Contains(_, "$")),
Dollars_Columns_Selected_Volumes_Source1 = List.Select(Table.ColumnNames(Total_Sales_DOLLARS_New_Name_Source1), each Text.Contains(_, "Volumes")),
 
 Headers_Source1  = Table.ColumnNames(Total_Sales_DOLLARS_New_Name_Source1),
 HeadersToRemove_Source1 = List.Combine({Dollars_Columns_Selected_DOLLAR_Source1,Dollars_Columns_Selected_Volumes_Source1}),
HeaderDifference_Source1    = List.Difference(Headers_Source1,HeadersToRemove_Source1),
 
Helper_Source1 = Table.AddColumn (
Total_Sales_DOLLARS_New_Name_Source1,
"Helper_Source1",
each Text.Combine (HeaderDifference_Source1, "")
)
 
I got a column with the concatenation, however the values in it are the names of the columns concatenated, and not the values in each of the column.
I know I need to use the following something similar to this:
 
each Text.Combine({
Record.Field(_, Input_Table_Column1),
Record.Field(_, Input_Table_Column2),
Record.Field(_, Input_Table_Column3),
Record.Field(_, Input_Table_Column4),
Record.Field(_, Input_Table_Column5)}, " ")
 
but I don't know how to do that using the variable HeaderDifference_Source1 to make this concatenation dynamic.
 
Thanks.
 
 
 
1 ACCEPTED SOLUTION
ZhangKun
Super User
Super User

Helper_Source1 = Table.AddColumn (
	Total_Sales_DOLLARS_New_Name_Source1,
	"Helper_Source1",
	each Text.Combine(
		List.Transform(HeaderDifference_Source1, (fn) => Record.Field(_, fn)), 
		""
	)
)

View solution in original post

2 REPLIES 2
ZhangKun
Super User
Super User

Helper_Source1 = Table.AddColumn (
	Total_Sales_DOLLARS_New_Name_Source1,
	"Helper_Source1",
	each Text.Combine(
		List.Transform(HeaderDifference_Source1, (fn) => Record.Field(_, fn)), 
		""
	)
)

Perfect. Many thanks.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors