Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

concatenate/append Columns with Different Column Names in same table

I have many columns of same table 

 

Table A

Monthly Plan  Weekly plan   Actual  Monthly Plan1  Weekly plan 2  Actual3

A                                 B              C                    D               E                F

 

 

I wanted them as :

 

Monthly Plan  Weekly plan   Actual 

 A                                 B                 C  

D                                 E                   F

I can not create a sperate table and append it because there are so many columns and i cant create too many tables.

  • NewStep=#table(List.FirstN(Table.ColumnNames(PreviousStepName),3),List.TransformMany(Table.ToRows(PreviousStepName),each List.Split(_,3),(x,y)=>y))

2 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    NewStep=#table(List.FirstN(Table.ColumnNames(PreviousStepName),3),List.TransformMany(Table.ToRows(PreviousStepName),each List.Split(_,3),(x,y)=>y))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks ,I am not sure If I can understand this code properly,can you please explain a bit more