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 = Lagerbewegungen,
Calc_Running_Total = Table.Group(
Source, // table as table
{"Produkt"}, // key as any
// aggregatedColumns as list
{{"Daten", // name of new column to be created
// Function Call
(Input as table) as table => // data for function
let
Call_Function = fn_cumulative_Total(Input),
// End of Function Call
result = Table.FromColumns( // tidy up
Table.ToColumns(Input)&{Call_Function},
Value.Type(
Table.AddColumn(
Input, "Saldo", each null, type number
)
)
)
in
result,
type table}} // transform into table
),
Expanded_Data = Table.ExpandTableColumn(Calc_Running_Total, "Daten", {"Datum", "Betrag", "Saldo"}, {"Datum", "Betrag", "Saldo"})
in
Expanded_Data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment