Forum Discussion
Running sum in a week
- Anonymous2 years ago
I have understood your needs, you need an Output column to calculate the cumulative data.
I created a table using your data:
Transform data > Add column > Index Column
At this point, there will be a column of serial numbers in multiple places.
Then create a calculated column:
-------------------------------------------------------------------
Output =
SUMX(
FILTER(
'Table',
'Table'[Index] >= EARLIER('Table'[Index]) && 'Table'[Week] = EARLIER('Table'[Week])
),
'Table'[Qty]
)
-------------------------------------------------------------------
This code uses the Filter function to filter from the bottom up, the Week column to set the range, and finally the SUMX function to iteratively aggregate.
The result is as follow:
I have understood your needs, you need an Output column to calculate the cumulative data.
I created a table using your data:
Transform data > Add column > Index Column
At this point, there will be a column of serial numbers in multiple places.
Then create a calculated column:
-------------------------------------------------------------------
Output =
SUMX(
FILTER(
'Table',
'Table'[Index] >= EARLIER('Table'[Index]) && 'Table'[Week] = EARLIER('Table'[Week])
),
'Table'[Qty]
)
-------------------------------------------------------------------
This code uses the Filter function to filter from the bottom up, the Week column to set the range, and finally the SUMX function to iteratively aggregate.
The result is as follow: