Fill Values of Other Series With Last When Stacking

I have two series, Phase A Power and Phase B Power. Phase B happens to have a few more measurements than Phase A:


The problem comes when stacking the values. For the data points where Phase B has a value, the stacked chart assumes a 0 for Phase A:

But I would need an option to assume the last value of Phase A.
Because in reality Phase A’s power only got down to 0 at 13:20 (Phase A’s next data point) and not at 12:57 (Phase B’s next data point).
For non stacked chart that displays nicely choosing the stepAfter line interpolation option that extends the line of the previous value until the next value.
But for the stacked option it’s displayed wrong.

How can I assume the last value for Phase A whenever Phase B has a datapoint, rather than assuming 0?

1 Like

Had the same problem.
I think you need interpolation of phaseA and phaseB, so for every timestamp you have some value of phaseA and phaseB. This could be easily achieved with postgres and timescale plugin.
For every series you do something like this:

SELECT
time_bucket_gapfill(‘1 minute’, timestamp) AS minute,
interpolate(avg(value))
FROM
measurements
GROUP BY minute
ORDER BY minute

1 Like