Issue with aggregateWindow sum function

Hello,

I am aggregating tick data and I seem to not understand why I am having issues with summing the volume field. It will not write data until I change fn: sum to fn: last, however I want to sum the data for this field. Below I attached some sample code with the sum aggregation that does not work as well as the another aggregation for the opening tick data which works just fine. What am I doing wrong?

parameters = {
	start: -3m,
	every: 1m,
	limit: 3,
	bucket: "CryptoData",
	org: "test",
}
dataset = from(bucket: parameters.bucket)
	|> range(start: parameters.start)
	|> filter(fn: (r) =>
		(r["_measurement"] == "CoinbasePro"))
	|> filter(fn: (r) =>
		(r["_field"] == "volume" or r["_field"] == "price"))

dataset
	|> filter(fn: (r) =>
		(r["_field"] == "volume"))
	|> aggregateWindow(every: parameters.every, fn: sum)
	|> map(fn: (r) =>
		({
			_time: r._time,
			product_id: r.product_id,
			_field: "volume",
			_measurement: r._measurement,
			_value: r._value,
			topic: r.topic,
			symbol: r.symbol,
		}))
	|> limit(n: parameters.limit)
	|> to(bucket: "ohlc_1m_data", org: "none")
dataset
	|> filter(fn: (r) =>
		(r["_field"] == "price"))
	|> aggregateWindow(every: parameters.every, fn: first)
	|> map(fn: (r) =>
		({
			_time: r._time,
			product_id: r.product_id,
			_field: "open",
			_measurement: r._measurement,
			_value: r._value,
			topic: r.topic,
			symbol: r.symbol,
		}))
	|> limit(n: parameters.limit)
	|> to(bucket: "ohlc_1m_data", org: "none")

I believe I solved the issue by calling the

|> cumulativeSum()

function after the aggregation. It seems to be working now