Calculate a sensor from another sensor with a different timestamp (yesterday)

Hello,

I am receiving energy consumption from Wienner Netze (Vienna energy distributor) as a value for yesterday consumption. Recalculation in grafana seems to be impossible, recalculation in InfluxDB is possible but beyond my capacity, rewriting the component is impossible as the authors argue they receive the data as they are from Wienner Netze.

Therefore, is it possible to do it using the template/helper method? The only thing I need is to save a value to a sensor with a timestamp saying “this value is for yesterday” so I can compare the reported value with the sum of every meter I have at home.

The current state of my graph is as follows (I do not measure stove and oven, which is the difference):