Transform -> undefined to 0

Hi,

I am making a Histogram to show my CO2 emission. I have several time series with energy consumption.

I make several transformations (binary operations to multiple the consumption with the CO2 coefficient, which is also a time series), after that, I make aggregation (Total) to show the total value as well.

Now my problem is: I have a new time series (new sensor in Home Assistant), the binary operation results in NaN for the days it didn’t existed, because the new series doesn’t have values for that dates. At this point I am OK with this. But when I aggregate the Total will not be counted for those days, the total will also be NaN.

What I want to achive:

  1. replace NaN-s to 0, so the total will count right, or
  2. make the Total aggregation “forget” about NaNs, and sum up all the non NaN values

Is it possible somhow?

You can do this using the special option under value mappings:

see this dashboard for an example:

https://play.grafana.org/d/s8ep4PAnz/mja-add-field-transformation?orgId=1&editPanel=2