I want to do a running total with power query like I did with Tableau software before. Does anyone have ideas, thanks in advance!
Apologies for the very late answer - this challenge has been nagging at me for many months.
There are few solutions floating around forums and blogs but they all seem to need pages of custom M code. Some also cant meet the common requirement of needing to restart the running total when a group changes.
So I came up a with a technique you can build without writing any custom code - you just click around in the Power Query window and add one very simple Custom Column.
The key steps are:
[Index] >= [#"All Rows - Copy.Index"]
I built a working solution which you can download from my OneDrive and try out:
http://1drv.ms/1AzPAZp
It's the file: Power Query demo - Running Total
Very easy.
Step 1: Add an index
#"Added Index" = Table.AddIndexColumn(#"**Prior Step**", "Index", 0, 1)
Step 2: Add a running total
#"Added Running Total" = Table.AddColumn(#"Added Index", "Running Total, each List.Sum(List.FirstN(#"Added Index"[**Column to Add Values From**],[Index]+1)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With