Forum Discussion
Anonymous
7 years agoNot applicable
Table.TransformColumns - repeat rows n times and add a new column with 1 to n
Hello, I have a revenue table that shows the total contract value, the start month, and the number of months (Term__c). I have been able to repeat the rows for the number of months, but I need to...
- Anonymous7 years ago
I figured it out myself. I added a custom colum that copied the Term__c so that I had the original total months, then modified the TransformColumns step to this. The key was to drop the 3rd increment argument and use underscore as the second argument. TIL that underscore is a reference to the loop field when using each this way.
Table.TransformColumns(#"Filtered Rows", {"Term__c", each List.Numbers(1,_), type list})
tony_lung
6 years agoNew Member
I'm not sure how the item listed in the solution actually gets you to the repeated rows. For me it just makes a column with a list type. This is what worked for me.
= Table.ExpandListColumn(Table.AddColumn(#"Filtered Rows", "MonthNumber", each List.Numbers(1,[Term__c])),"MonthNumber")
whothefoo
6 years agoFrequent Visitor
Ideal, thanks Tony