Running Total & Running Product Using List.Accumulate() in Power Query

Опубликовано: 01 Июнь 2026
на канале: Josh_Excel
752
17

#power_query #powerquery
Steps For Running Total and Running Product:
1. Create/Import Table with Numbers
2. Add Index Column Starting with 1
3. Add Custom Column for Running Total:
= List.Accumulate(L1, {0}, (A,B)=˃ A & {List.Last(A)+B})
1. Copy and Modify Running Total Formula for Running Product:
= List.Accumulate(L1, {1}, (A,B)=˃ A & {List.Last(A)*B})

Advanced Editor Code:

let
Source = null,
T1 = #table(type table[Num=Int64.Type],{{5}, {5}, {5}, {5}, {5}, {5}}),
Custom1 = T1,
AI = Table.AddIndexColumn(Custom1, "Index", 1, 1, Int64.Type),
RT = Table.AddColumn(AI, "Running_Total", each List.Accumulate(T1[Num], {0}, (A,B)=˃ A & {List.Last(A)+B}){[Index]}, Int64.Type),
RP = Table.AddColumn(RT, "Running_Product", each List.Accumulate(T1[Num], {1}, (A,B)=˃ A & {List.Last(A)*B}){[Index]}, Int64.Type)
in
RP