Track liter usage of tank

I have a tank at home which is periodically filled. I have a sensor which tells me how much usage (liter) there was yesterday.

I would now like to track the remaining liter in the tank, by summing all my yesterdays levels since it was filled.

So:

  • I know the level it has when it was filled (lets say 1000l got delivered) (X)
  • I know the date it was filled (Y)
  • I know the usage of every day (Z)

Can I now have a sensor which SUMS all the yesterdays Values (Z) since a specific date (Y)?

I tried using a historic sensor, but it seems that one is more limited to having a certain state, while the state I have in Z can be anywhere from 0 liter to 20 liter, with 2 decimals.

History Stats - Home Assistant

Sorry you said you tried that!