This one seems to work:

IIf([QuantityOut]>=0,[QuantityIn]-[QuantityOut],[QuantityIn])