Forum Discussion

Dicken's avatar
Dicken
Post Prodigy
1 year ago
Solved

Inserting Rows at given postion in table

Just thought this may be of interest to someone,  to insert rows at given interals in a tablle, here I have used a list for easy illustration, but just convert table  to records, and create records...
  • slorin's avatar
    1 year ago

    Hi Dicken 

     

    Add null item every 3 items in a list

     

    let
    Source = {"A".."Z"},
    Result = List.Combine(List.Transform(List.Split(Source, 3), each _ & {null}))
    in
    Result

     

    Add null record every 3 rows in a table

     

    let
    Source = Table.FromColumns({{"A".."Z"}, {1..26}}),
    Null_Table = Table.Buffer(Table.FromColumns({{null}}, List.FirstN(Table.ColumnNames(Source),1))),
    Result = Table.Combine(List.Transform(Table.Split(Source, 3), each _ & Null_Table))
    in
    Result

     Stéphane