Screen shots are below. One shows my data set. The second shows what I am trying to calculate. I have one record per well per day. There is a downtime column that tells me how many hours a well was down in a give day. I would like to count consecutive days of downtime where downtime = 24. If the calculation encounters a record (in date order) where downtime drops below 24 hours, the calculation should stop and return null and then pick up again counting consecutive days when downtime = 24.
Then I will need to identify the blocks of dates where consecutive days of downtime are 60 days or more so that I can count up the number of wells that were not down in a given month. If a well has 60 days of consecutive downtime that falls across three months, I will remove it from the well count from all three of those months.