Hi,
I've been trying to add a column to grouped 'all rows' which give previous row value;
I have this working in non group ;
Table.AddColumn(#"Changed Type", "Custom", each List.Last(
Table.SelectRows( #"Changed Type" , (A)=> A[Date] < _ [Date] and A[Item] = _ [Item]
)[Unit] ) ))
But I thought it might be easier to group by iitem and do the same for each group;
Table.Group(#"Changed Type", {"Item"}, {{"Count", each Table.AddColumn( _ , "new", (B)=> 1)}} )
and then tried to build on that,
Table.Group(#"Changed Type", {"Item"}, {{"Count", each Table.AddColumn( _ , "new", (B)=> Table.SelectRows( _ , (A)=> A[Date] < _ [Date] ) ) }} )
I've managed to make a function and invoke on the grouped date shown in attachment,
Richard
Bookmarks