# Sum of field on condition

I have a report that calculates the total number of items ordered and also of those ordered total number received late and on time. I have run into a problem where negative numbers are being added to the overall late total and I do not want them to be. For example the person receiving in an order accidentally received in 80 items when we really only received 40. This error wasn't noticed till the next day so that person when back in to remove the additional 40. When I pull data for that specific supplier it shows 40 received and -40 taken out the next day. The report doesn't recolonize that the symbol means removed and instead counted it as late since it was removed the day after and is now being added to the total of late field. Is there a conditional formula I could use to ignore any quantities with the negative symbol in front of it?

##### Tags:

##### lenore sherman replied

I was able to solve this problem by using the following formula for the "total late" field

if {recv_log.quantity} > 0 then IF {@On-time/ Late delv} ="L" THEN {recv_log.quantity} else 0