Get percentage of time with ACTIVE problems and not

Hi!

We would like to create a query which checks a timeperiod for all “timebuckets” where a problem was open.

fetch events
| filter event.kind == "DAVIS_PROBLEM"
| filter event.category == "AVAILABILITY"
| filter event.status == "ACTIVE"
| filter contains(event.name,"BSN0001632")
| makeTimeseries interval:1m, count = count(default:0)

This is the closest I have come, but it is not quite what I am after.

One of the questions is if an open event will show as ACTIVE in all timeperiods between event.start and event.end