If you really wanted it to be one goal, you could make it a do-more goal with a unit of hours and a rule that numbers over 40h (or some other number) for that week have to be entered as negatives.
(If you leave the aggregation as sum, whenever you get to 40h for a week you can enter two datapoints for that day, like so:
where the 2 lines for day 5 mean “reached 40h after 2h of work on day 5” and “worked an extra (excessive) 5h on top of that”. With this rule, a rate of 35h / week might be appropriate, meaning you just squeaked by this week.)
That does let you build up some buffer by working exactly 40h / week though, which might or might not be desirable. And it treats weeks as a special unit of time, which they sort of are, but if you want the definition to be more elegant, it’s probably way easier to use two goals.