Forum Discussion

kkoons668's avatar
kkoons668
Regular Visitor
3 years ago

Concatenate Varying # Of Columns in Power Query

Hey all,

 

I have a need to take my table, and concatenate each value in the first row into one cell, removing all others.

 

So if the table looks like this in PQ. I need to consolidate all cells into one, with a ", " in between each one. The problem I'm running into is that each time I refresh the report, the total number of columns can be different, either growing or shrinking in total number so I can't hard-code a set number of columns, it has to be variable. Any suggestions is appreciated! 

 

1 Reply

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    NewStep=Table.FromColumns({Table.ToList(PreviousStepName,each Text.Combine(List.Transform(_,Text.From),","))},{"NewMergedColumn"})