Thanks for everyone's help. I think I stumbled into the solution. I was getting null values for some of the sum(billed) because not every project had been billed...
I am pretty sure that this is not working correctly as I executed it and it kept going for ten minutes. Meanwhile it generated 10 million lines of "1...