Create a sensor that sums only negative values from another sensor

Hi,
I’ve an ultrasound sensor for my water tank and it shows the current capacity on a sensor.
I’d like to create another sensor that sums only the negative values of this sensor (let’s call it sensor.waterpump) and ignore positive values, in order to have only the consumption stat.

What’s the best way to do so?