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.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    At what time do you want to do this? At record query time, at record update time, in a process, at UI level?

    For which purpose? A validation?

    Do you need to do this for many users at the same time or only one?

  • The process would run daily to process the entire set of records and calculate for the given date. More succinctly if I go back to my example above. It would run once at the end of the day for the 8th and determine that the current result is false. Then on the 9th it would run at the end of the day and determine result is true.

    Record query time -> No

    Record update time -> Maybe

    in a process -> Yes

    UI -> No

    The purpose is to have a points accumulation system. When they break this threshold they achieve a point. The following day if they break the threshold they earn a point. 

    The user would only ever see their points they have accumulated by month.

    This process should run daily and process the total calculation for all users that exist in the table.

Reply
  • The process would run daily to process the entire set of records and calculate for the given date. More succinctly if I go back to my example above. It would run once at the end of the day for the 8th and determine that the current result is false. Then on the 9th it would run at the end of the day and determine result is true.

    Record query time -> No

    Record update time -> Maybe

    in a process -> Yes

    UI -> No

    The purpose is to have a points accumulation system. When they break this threshold they achieve a point. The following day if they break the threshold they earn a point. 

    The user would only ever see their points they have accumulated by month.

    This process should run daily and process the total calculation for all users that exist in the table.

Children