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 September 15. Request your voucher.

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
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