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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Use Table header as the column name in a merge query

I want to use the Table header value as the column name in a merge query I have (from a previous question)

 

#"Merged Columns" = Table.CombineColumns(#"Trimmed Text",mergeHeaders[headers],Combiner.CombineTextByDelimiter("|", QuoteStyle.None),"Merged")

 

I have tried replacing Merged with mergeHeaders[headers]  but get the error

 

Expression.Error: We cannot convert a value of type List to type Text.
Details:
    Value=[List]
    Type=[Type]

 

 

I have also tried mergeHeaders[headers]{0} I get no error but the merge no longed outputs data

 

Thank you

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Use this in place of mergeHeaders[headers]

 

Text.BetweenDelimiters("mergeHeaders[headers]","[","]")

 

Note - For this merge to work, you require at least 2 column names which exist in #"Trimmed Text". This result should appear in the place where you would place this. Refer the doc here - https://docs.microsoft.com/en-us/powerquery-m/table-combinecolumns 

 

View solution in original post

2 REPLIES 2
Vijay_A_Verma
Super User
Super User

Use this in place of mergeHeaders[headers]

 

Text.BetweenDelimiters("mergeHeaders[headers]","[","]")

 

Note - For this merge to work, you require at least 2 column names which exist in #"Trimmed Text". This result should appear in the place where you would place this. Refer the doc here - https://docs.microsoft.com/en-us/powerquery-m/table-combinecolumns 

 

Anonymous
Not applicable

Yes, that's great! Thank you again

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors