I need to concatenate columns on a pipe | from a table of column names in such a way that keeps the original columns
I can do this with merge, but I lose the original columns
How to do this without losing the columns being contaminated?
Thanks
#"Trimmed Text" = Table.TransformColumns(#"Sorted Rows",{{"Id", Text.Trim, type text}}),
newMergedHeader = Table.ColumnNames(mergeHeaders){0},
#"Merged Columns" =
if newMergedHeader <> null then
Table.RenameColumns(
Table.CombineColumns(#"Trimmed Text",Table.Column(mergeHeaders,newMergedHeader),each Combiner.CombineTextByDelimiter("|", QuoteStyle.None)(List.Difference(List.RemoveNulls(_), {""})),"Merged"),{{"Merged",newMergedHeader}})
else #"Trimmed Text
Input
| Other Colums | Label | Segment | Type | Other Colums |
|--------------|--------------------|----------------------|--------|--------------|
| stuff | Alexis Bhat | | | stuff |
| stuff | Alphonse Wilkinson | | Person | stuff |
| stuff | Bobbi Carter | Network Blue | | stuff |
| stuff | | Community Healers | Person | stuff |
| stuff | Dannie Cano | Community Healers | Person | stuff |
| stuff | Darius Neel | Community Healers | Person | stuff |
| stuff | | | | stuff |
| stuff | Delores Rana | Community Healers | Person | stuff |
| stuff | Dionne Merino | Education Commission | Person | stuff |
Output
| Other Colums | Label | Segment | Type | Other Colums | Blue |
|--------------|--------------------|----------------------|--------|--------------|-------------------------------------------|
| stuff | Alexis Bhat | | | stuff | Alexis Bhat |
| stuff | Alphonse Wilkinson | | Person | stuff | Alphonse Wilkinson|Person |
| stuff | Bobbi Carter | Network Blue | | stuff | Bobbi Carter|Network Blue |
| stuff | | Community Healers | Person | stuff | Community Healers|Person |
| stuff | Dannie Cano | Community Healers | Person | stuff | Community Healers |
| stuff | Darius Neel | Community Healers | Person | stuff | Person |
| stuff | | | | stuff | |
| stuff | Delores Rana | Community Healers | Person | stuff | Delores Rana|Community Healers|Person |
| stuff | Dionne Merino | Education Commission | Person | stuff | Dionne Merino|Education Commission|Person |




mergedHeaderstable