Forum Discussion
eeew00
6 years agoHelper I
Duplicate column with offset one row inside grouped table
Hello! Easier to explain in pictures, so: I have grouped the data by user and what I would like to do now is to duplicate the "DateAndTime" column in each user table("Custom" column) AN...
- Anonymous6 years ago
try this way:
let ... ... breakTab=(tab as table) => let timeDiff=List.Accumulate(List.Numbers(1,Table.RowCount(tab)-1), {},(s,c)=>s&{tab[Time]{c}-tab[Time]{c-1}}) in Table.FromColumns({timeDiff},{"timeDiff"}), diff= Table.Group(yourTab, {"Group"}, {{"Diff", each breakTab(_), type table}}), te = Table.ExpandTableColumn(diff, "Diff", {"timeDiff"}, {"timeDiff"}) in te