Forum Discussion
Mederic
Post Patron
2 years agoRunning total
Hello, I have a Power query code that works in the 1st case but not in the 2nd (see screenshot below) How can I please modify this code so that it works in both cases ? =List.Sum(Table.Sele...
- 2 years ago
The formula only works when the [Column] is in Ascending Order (e.g. next row is always greater than the next). If you want to use that formula, Add an [Index] column before adding the running total.
=List.Sum(Table.SelectRows(#"Changed Type", (x)=> x[Index]<=[Index])[Qty])The formula is not efficient, but it will work if you are a beginner and you have a small data set.
spinfuzer
Solution Sage
2 years agoThe formula only works when the [Column] is in Ascending Order (e.g. next row is always greater than the next). If you want to use that formula, Add an [Index] column before adding the running total.
=List.Sum(Table.SelectRows(#"Changed Type", (x)=> x[Index]<=[Index])[Qty])
The formula is not efficient, but it will work if you are a beginner and you have a small data set.