Forum Discussion
Anonymous
10 years agoNot applicable
Restart count in column
I'm adding a column to a date table. The column needs to count to 20 by rows and restart. Example: Year Month Day BusPeriod 2013 06 13 15 2013 06 ...
- 10 years ago
You can add an index column, and then transform that column into something like: Number.Mod([Index] + 1, 20)
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1), #"Calculated Factorial" = Table.TransformColumns(#"Added Index",{{"Index", (index) => Number.Mod(index, 20) + 1, type number}}) in #"Calculated Factorial"
arify
Microsoft Employee
10 years agoYou can add an index column, and then transform that column into something like: Number.Mod([Index] + 1, 20)
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1),
#"Calculated Factorial" = Table.TransformColumns(#"Added Index",{{"Index", (index) => Number.Mod(index, 20) + 1, type number}})
in
#"Calculated Factorial"- Anonymous10 years agoNot applicable
Works like a charm, nice solution arify!