Use the same function to update bounds and calc start/end when inserting measurements.

Create one synthetic sensor for total calculations.
Fill in the gaps when calculating difference series.
Custom add and min and max dates from all sensors in a dataset (used for padding).
Create additional sensor type for difference series.
Difference series stored in measurements table.
Difference series sensor becomes PULSE.