How to create calculation to count values for a time period then reset

I want to create a calculation to count (add together) values taken every 1 minute for 12 hours, then reset to whatever the value is at the start of the next 12-hour period, then begin again (see my concept diagram below). I am using PI Processbook...

Is this possible? Grimacing ChatGPT tells me to use tagtot('tag','*','*-12h') but I can't seem to get it to work how I need it to with intervals and correct value/count/total selection... Thank you! Blush


image.png.png