@sbedows
Here's how to do it. Assume we have collection that looks like this
ClearCollect(colData,
{ProjectID: 1, StageID: 1, StageDays: 1},
{ProjectID: 1, StageID: 2, StageDays: 2},
{ProjectID: 1, StageID: 3, StageDays: 6},
{ProjectID: 1, StageID: 4, StageDays: 4},
{ProjectID: 2, StageID: 1, StageDays: 3},
{ProjectID: 2, StageID: 2, StageDays: 5}
);
Then you can use this code to create a new collection for Project #1 with the RunningTotal included.
ClearCollect(
colSolution,
AddColumns(
Filter(colData, ProjectID=1) As TableXY,
"RunningTotal",
Sum(Filter(colData, StageID<=TableXY.StageID), StageDays)
)
);
The final result will look like this:
| ProjectID |
StageID |
StageDays |
RunningTotal |
| 1 |
1 |
1 |
1 |
| 1 |
2 |
2 |
3 |
| 1 |
3 |
6 |
9 |
| 1 |
4 |
4 |
13 |
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."