Calculate rolling sum by userId
I'm trying to figure out how I would configure an expression rule to perform a rolling sum by userId.
For a given person, calculate how many hours they worked for a rolling 7 days, and if they have exceeded 10 hours then return true. Otherwise, false.
My data looks like this:
| UserID | workDate | Hours |
| 1 | 06-03-2022 | 1 |
| 1 | 06-04-2022 | 3 |
| 1 | 06-05-2022 | 1 |
| 1 | 06-07-2022 | 3 |
| 1 | 06-08-2022 | 1 |
| 1 | 06-09-2022 | 3 |
| 1 | 06-10-2022 | 2 |
| 1 | 06-13-2022 | 4 |
| 2 | 06-13-2022 | 7 |
Given the table above, it calculates from the current date (inclusive) for the last 7 days.
| UserID | workDate | Hours | Last 7 days | response |
| 1 | 06-03-2022 | 1 | 1 | false |
| 1 | 06-04-2022 | 3 | 4 | false |
| 1 | 06-05-2022 | 1 | 5 | false |
| 1 | 06-07-2022 | 3 | 8 | false |
| 1 | 06-08-2022 | 1 | 9 | false |
| 1 | 06-09-2022 | 3 | 12 | true |
| 1 | 06-10-2022 | 2 | 12 (06-03 dropped off) | true |
| 1 | 06-13-2022 | 1 | 10 (06-07 to 06-13) | false |
| 2 | 06-13-2022 | 7 | 7 | false |
Is it possible to configure a calculation like this in Appian? For all intents and purposes, once they have broken the 10 hour mark a separate table would be updated to mark the number of times in a given month they broke the 10 hour consecutive hours.
If it is possible, how would I go about doing this?
p.s. sorry if i used some nomenclature wrong. Appian is a new experience for me.
