( by Tnite )
Have a look at the following screenshot:
And I have the following formula in Cell F1:
=query(A:D;"select B,sum(D) where B is not null group by B label B 'Date', sum(D) 'Total' ")
So now you have a single formula solution, and when you will update the data in range A:D, the data will auto update on columns F and G.