Forum Discussion
Anonymous
3 years agoNot applicable
Reference Previous Row Without Sorting & Index
Hi, I have a datasheet with a [depth] value, a [dollar] value, and a [category] value. I would like to create a column that references the [dollar] value from the previous [depth] row, for each [...
Anonymous
3 years agoNot applicable
Anonymous Thanks for the quick response, I sure appreciate it.
That's an interesting idea, but I'm not sure how multiple data flows would differ from a single data flow. Don't I have to perform the same transformations in the second data flow, which references the previous row from the first dataflow?
Poohkrd
3 years agoAdvocate I
Hi, it's differs a lot. And what algorithm you use after indexing your table?
Try this one:
let
Source = Table.FromColumns({{"a","b","c","d"}},{"col"}),
col = List.Buffer({null}&Source[col]),
AddedIndex = Table.AddIndexColumn(Source, "ind", 0, 1),
TransformToPrevRow = Table.TransformColumns(AddedIndex, {{"ind", each col{_}}})
in
TransformToPrevRow