Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Code written by Hans Peter Pfister, www.powerbi-pro.com
(Input as table) =>
let
Sorting = Table.Sort(Input,{{"Datum", Order.Ascending}}), // Sort table
added_Index = Table.AddIndexColumn(Sorting, "Index", 1, 1), // add Index, base 1
cumulativ_total = Table.AddColumn( // add new column with running total
added_Index, "Saldo",
each List.Sum(
List.Range(added_Index[Betrag],0,[Index])
)
),
extract_total = cumulativ_total[Saldo] // transform new column into list as result for grouping
in
extract_total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment