Add Running Total with One Formula in Power Query

Опубликовано: 26 Март 2026
на канале: Josh_Excel
570
32

Steps:
1. Create Blank Query and Copy and Paste Formula into Advanced Editor
2. Reference this function by adding parameter for Table and Column to Sum

(tab as table, colname as text) =˃
Table.PromoteHeaders(Table.FromColumns(Table.ToColumns(Table.DemoteHeaders(tab)) & Table.ToColumns(Table.DemoteHeaders( Table.FromColumns({
List.Accumulate(Table.Column(tab,colname), {}, (state, current) =˃
state & {
if List.Count(state) = 0
then current
else current + List.Last(state)
})}, {colname & "Running Total"})))))


(Remember to replace the "˃" arrow with greater than sign in your advanced editor
~~~~~~~~~~~~~~~~~~~~~~~~~
Please checkout my book, Power Query M Language Basics Kindle Edition here -˃
https://www.amazon.com/dp/B0DM73H3RV

~~~~~~~~~~~~~~~~~~~~~~~~