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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.