Have you seen the following OSI Channel YouTube videos?
You should be able to adapted the DailyRunningTotal AF analysis to do what you want.
Here is example from AF Analysis, totalizer 06-06...
If Hour('*')<6 then TagTot('tag','t-18h','*')*24 else TagTot('tag','t+6h','*')*24
I advise to use AF Analysis for this. Depending on the need you can schedule an evaluation once a day (06:00AM), or you can calculate the total every time the flow (of the header) or the valve position has been updated.
You can use TIMEWEIGHTED Totalizer for the Header tag as the source tag.