@vadus1 it's better to calculate sum via sql at first, and then subtract whole sum.