Incorrect/Strange Last Value in output when using aggregateWindow

I’m monitoring home power consumption and submitting the usage metrics from a series of smart plugs to influxDB every 5 seconds. I’ve got no issues graphing the raw data, but when I try to create cumulative graphs, it works fine except for the last value, which is pretty much double what it should be.

The query I’m using is the following:

from(bucket: "EnergyBucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "30daykwh")
  |> filter(fn: (r) => r["_field"] == "30daypowerw")
  |> aggregateWindow(every: 5m, fn: mean, createEmpty: false)
  |> drop(columns: ["location"])
  |> aggregateWindow(every: 5m, fn: sum, createEmpty: false)

I use the mean to gather the mean value of all of the 5 second points in each 5 minute window. Then I drop the name of the energy source “location” , so I can aggregate all of the different sources into a single total value.

Any idea what might be causing the sudden spike for the last value? I’m using InfluxDB 2.0.7