from(bucket: “Grafana_Bucket”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) =>
r._measurement == “19042023_V24_City_1R_ECO_sathish_battery_switch_test_new” and
(r._field == “BF_CellVoltage1” or r._field == “BMSF_ChargingCurrent”)
)
|> pivot(
rowKey:[“_time”],
columnKey: [“_field”],
valueColumn: “_value”
)
|> map(fn: (r) => ({ r with power: r.BF_CellVoltage1 * r.BMSF_ChargingCurrent }))
|> sum(column: “power”)
|> aggregateWindow(every: 1d, fn: sum, column: “power”)
|> rename(columns: { power: “energy” })
|> keep(columns: [“_time”, “energy”])
Error:No column"_time" found…even though i have time column in influxdb data base
sum functions removes time column, since there is no time associated with a specific timestamp on the sum of all values. You could try cumulativesum instead, that way the last timestamps will have the total sum of all previous ones