Forum Discussion
Table.TransformColumns - repeat rows n times and add a new column with 1 to n
- 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})
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_lung7 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")
- whothefoo7 years agoFrequent Visitor
Ideal, thanks Tony
- whothefoo7 years agoFrequent Visitor
Hi Anonymous , can I ask how you managed to repeat the rows by the number of months please, i'm really stuck on this one?
Thank you
- andreaf3 years agoNew Member
watch this video, it was really helpful for me: https://www.youtube.com/watch?v=6NAQf9b5J14