I am trying to calculate a moving sum that is "N" days from the date specified on the row. I also need this calculation to fix itself to both distinct store and sku combination (as shown below). In the scenario below I am creating a fourth column that calculates a moving running total for the last 5 days (including the current date). In other tools such as Tableau I would calculate this as a window sum and fix the calculation at store and sku.
| Store | SKU | Date | Sales | 5 Day Running Sum |
| 1 | 1111 | 1/1/2021 | 5 | 5 |
| 2 | 1111 | 1/1/2021 | 5 | 5 |
| 1 | 1111 | 1/2/2021 | 6 | 11 |
| 2 | 1111 | 1/2/2021 | 6 | 11 |
| 1 | 1111 | 1/3/2021 | 7 | 18 |
| 2 | 1111 | 1/3/2021 | 8 | 19 |
| 1 | 1111 | 1/4/2021 | 3 | 21 |
| 2 | 1111 | 1/4/2021 | 3 | 22 |
| 1 | 1111 | 1/5/2021 | 4 | 25 |
| 2 | 1111 | 1/5/2021 | 5 | 27 |
| 1 | 1111 | 1/6/2021 | 1 | 21 |
| 2 | 1111 | 1/6/2021 | 1 | 23 |
| 1 | 1111 | 1/7/2021 | 5 | 20 |
| 2 | 1111 | 1/7/2021 | 5 | 22 |
| 1 | 1111 | 1/8/2021 | 2 | 15 |
| 2 | 1111 | 1/8/2021 | 2 | 16 |
| 1 | 1111 | 1/9/2021 | 4 | 16 |
| 2 | 1111 | 1/9/2021 | 4 | 17 |
| 1 | 1111 | 1/10/2021 | 6 | 18 |
| 2 | 1111 | 1/10/2021 | 6 | 18 |
| 1 | 1111 | 1/11/2021 | 8 | 25 |
| 2 | 1111 | 1/11/2021 | 8 | 25 |
| 1 | 1111 | 1/12/2021 | 9 | 29 |
| 2 | 1111 | 1/12/2021 | 5 | 25 |
| 1 | 1111 | 1/13/2021 | 2 | 29 |
| 2 | 1111 | 1/13/2021 | 2 | 25 |
| 1 | 1111 | 1/14/2021 | 6 | 31 |
| 2 | 1111 | 1/14/2021 | 6 | 27 |