Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Code written by Hans Peter Pfister, www.powerbi-pro.com
let
Source = (Input as table) =>
let
Sorting = Table.Sort(Input,{{"Date", 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, "Total",
each List.Sum(
List.Range(added_Index[Amount],0,[Index])
)
),
extract_total = cumulativ_total[Total] // transform new column into list as result for grouping
in
extract_total
in
Source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.