Sum up only positive values of expression in time series

It’s no query but just an expression. $A is the consumption, $B is the production