I would do this with a Kapacitor job using the StateDuration node. The stateDuration node allows you to track the duration of a field at a specific value and will output a new field called “state_duration”. This can then be utilized in an alert or you could reemit the record into a different InfluxDB table.
|stateDuration(lambda: “signal_state” == 1)
You can also do this as a batch job using a batch node to look at your prior years data. With your new table, you can then report on the number of occurrences of the “high” state value.