The answer maybe, I am afraid, that yes it is possible. There are, essentially, two methods through which such a deduction (known as a set-off) can be made. The first, as Jon has described, is a contractual set-off. In other words, a contractual right in one contract to use monies in another contract. In addition, there is a second method of equitable set-off where a number of projects are very similar. The test is whether the claim for defects is so closely related to you claim for money on another project that it would be manifestly unjust to allow the claim for payment without taking into account the claim for defects.
I am afraid that this can be quite complicated to work out and is very fact sensitive. However, where you have different works, at different locations for different types of projects would make an equitable set-off extremely unlikely. Usually you need more connection than just the parties being the same to get over the "manifestly unjust" hurdle.