Forum Discussion

agd50's avatar
agd50
Helper V
3 years ago
Solved

Expanding/Duplicating Rows with the same values?

 I want to be able to duplicate a row only if the value is 2, 3 or more - so that it will duplicate it to this value  (ie 2 = 2 rows). The rest of the row includes workers details. Is this possib...
  • Ahmedx's avatar
    3 years ago

    I'm sorry, you can shorten the M code like this

    = Table.TransformColumns(
    from, { "Count", (x)=> 
     List.Transform(List.Repeat( {x},x),(y)=> 1)
    }
    )

    to

    = Table.TransformColumns(
    from, { "Count", (x)=> List.Repeat( {"1"},x)
    })