Calculation power from Current and Voltage using a transformation


I’m storing a current and voltage value in InfluxDB. I’m trying to use the new Transformation function in Grafana to calculate power in a graph.

It seems to work, but because current and voltage are not collected at the exact same moment, I see a lot of null values. I have “Null value -> connected” set, and it works for the current and voltage data sets. But the transformation graph shows spikes and 0 values, not the expect line.

Could it be that the transformation returns 0 and not null when one of the two is null?

Any way to work around this?


Actually, after switches to a table, I can see that the issue is that the data does not comes at every expected interval. Say I have data at 15,30 and 60 seconds. The two normal graphs shows lines. The Transformation shows correct data at 15,30 and 60 seconds, but shows 0 for 45 seconds.

That sounds like a bug?

I you want to fill null values with something, use: fill(0) at the end of query


SELECT mean(“P_Red”) FROM “Potencias” WHERE (“Tipo” = ‘$Resolucion’) AND timeFilter GROUP BY time(__interval) fill(0)

That query plots Grid Power and fill with zeros when it is no data