Hi,

I am new to InfluxDB and am trying to use Kapacitor for some ETL.

This is what I have in InfluxDB. The data represents the 99th percentile for latency for two http endpoints (services A and B) at 1 minute intervals.

The time field is an InfluxDB timestamp but I have used the notation H{X}M{Y} to represent hour X, minute Y.

```
time service p99
H1M1 A 289
H1M2 B 177
H2M1 A 134
H2M2 A 78
H2M3 B 123
```

What I want to do is transform this data to calculate an overall service level percentage. For this example, I will assume the service level percentage is required each hour.

Lets say the service level objectives for each service are as follows. i.e. p99 for service A must be less than 200 and for service B p99 must be less than 150.

```
service value
A 200
B 150
```

Step 1: Determine if the service meets the service level objective. (I am using 0 to represent a failure below)

```
time service p99 ok
H1M1 A 289 0
H1M2 B 107 1
H2M1 A 134 1
H2M2 A 78 1
H2M3 B 163 0
```

Step 2: Calculate the % of minutes for each hour that meet the service level objective.

```
time percentage
H1 50
H2 66.67
```

I want to produce these numbers every hour so running in batch every hour to calculate the previous hour is fine.

I have tried writing the transformation in Kapacitor but had some difficulty working out how to store the service levels and then also deriving the final percentage by hour.

Any guidance greatly appreciated.