Stacking irregular series

  • What are you trying to achieve?

I have multiple time series in InfluxDB 2 that I am querying with flux.

I want to stack them so I can easily gauge the total sum of all these series for each point in time, as well as to be able to gauge the contribution of each series to the total sum.

  • How are you trying to achieve it?

I am setting the stacked option for the graph in Grafana.

  • What happened?

Because some these time series are coming from Homeassistant with irregular intervals, Grafana treats them as 0 when performing the addition.

This results in ragged graphs that don’t show the total sum, because not all measurements are alway present for the same time slot.

  • What did you expect to happen?

When drawing non stacked, the series are interpolated to form continuous lines.

I expect the values of these lines to be stacked, so that I get an actual meaningful sum of the data, as can be seen here when stacking only the regular series from Telegraf:

Welcome @cfra to the forum.

Can you share your Flux query for the first one (that “ragged graphs”) and a portion of the table of data (preferably in .CSV format) that the query returns, showing where not all measurements are always present for the same time slot?

Depending on the precision you require, perhaps normalizing the irregular timestamps would help?