Created
June 4, 2018 18:54
-
-
Save HansPeterPfister/870139f30ad8b0ad3c03e2b52c26179c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code written by Hans Peter Pfister, www.powerbi-pro.com | |
let | |
Source = StockMovements, | |
Calc_Running_Total = Table.Group( | |
Source, // table as table | |
{"Product"}, // key as any | |
// aggregatedColumns as list | |
{{"Data", // name of new column to be created | |
// Function Call | |
(Input as table) as table => // data for function | |
let | |
Call_Function = fn_cumulative_Total_en(Input), | |
// End of Function Call | |
result = Table.FromColumns( // putting all together | |
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, "Data", {"Date", "Amount", "Saldo"}, {"Date", "Amount", "Total"}), | |
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Data",{{"Product", type text}, {"Date", type date}, {"Amount", Int64.Type}, {"Total", Int64.Type}}) | |
in | |
#"Changed Type" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment