Hi dear,
I have a requirement about difference(). When I use this method with the record(1,2,null,null,5,6), the result will be(1,null,null,3,1). I don’t expect the fifth value 5 will substract the second value 2. Can I hava it to be 0 or null instead. The result was expected as (1,null,null,2,1) or (1,null,null,0,1).
from(bucket: “ems”)
|> range(start: 1673712000)
|> filter(fn: (r) => r._measurement == “T3_5s”)
|> filter(fn: (r) => r[“_field”] == “ac_history_negative_power_in_kwh” and r.system == “1” and r.type == “2”)
|> aggregateWindow(every: 15m, fn: last)
|> pivot(rowKey: [“_time”], columnKey: [“_field”], valueColumn: “_value”)
|> difference(columns: [“ac_history_negative_power_in_kwh”])
The result was expected as (1,null,null,null,1) or (1,null,null,0,1). sorry for the error spell.
anyone kind can help?