Skip to content

Instantly share code, notes, and snippets.

@ImkeF
Created April 26, 2019 19:04
Show Gist options
  • Save ImkeF/4ec90606617eb5a48e78e2ec02e7bdb8 to your computer and use it in GitHub Desktop.
Save ImkeF/4ec90606617eb5a48e78e2ec02e7bdb8 to your computer and use it in GitHub Desktop.
let func =
(MyTable as table, MyColumnName as text) =>
let
Source = MyTable,
ShiftedList = {null} & List.RemoveLastN(Table.Column(Source, MyColumnName),1),
Custom1 = Table.ToColumns(Source) & {ShiftedList},
Custom2 = Table.FromColumns(Custom1, Table.ColumnNames(Source) & {"Previous Row"})
in
Custom2 ,
documentation = [
Documentation.Name = " Table.PreviousRow ",
Documentation.Description = " Superfast way to reference previous row ",
Documentation.LongDescription = " Superfast way to reference previous row ",
Documentation.Category = " Table ",
Documentation.Source = " www.TheBIccountant.com . http://tiny.cc/hhus5y . ",
Documentation.Version = " 1.0 ",
Documentation.Author = " Imke Feldmann: www.TheBIccountant.com. http://tiny.cc/hhus5y . ",
Documentation.Examples = {[Description = " ",
Code = " ",
Result = " "]}]
in
Value.ReplaceType(func, Value.ReplaceMetadata(Value.Type(func), documentation))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment