Forum Discussion
kobo237cs
Apr 08, 2019Copper Contributor
I need help to produce duplicated rows the number o which is defined by a column value
Hello, I have a specific problem to solve. I need to produce multiple rows with same attributes and the number of those rows to correspond to a value from a column in the same row. I tried to accomp...
SergeiBaklan
Apr 08, 2019Diamond Contributor
kobo237cs , to transform first table to the second with Power Query
you may first add custom column with
List.Repeat({[Incident ID]},[Number of Times])
to repeat your texts into the list, and after that expand that list into the rows. Entire script is like
let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content], AddListOfTexts = Table.AddColumn(Source, "Incident", each List.Repeat({[Incident ID]},[Number of Times])), ExpandList = Table.ExpandListColumn(AddListOfTexts, "Incident"), AddOne = Table.AddColumn(ExpandList, "Number", each 1), RemoveUnused = Table.SelectColumns(AddOne,{"Incident", "Number"}) in RemoveUnused
and in attached file.
- kobo237csApr 09, 2019Copper Contributor
- SergeiBaklanApr 09, 2019Diamond Contributor
kobo237cs , you are welcome