Hi there,
I have tried to write a query for your problem with this sample table, tblPurchaseOrder - PurchaseOrderDate & GrandTotal
here it is-
select weekno,newdate,sum(grandtotal) as grandtotal from
(select datepart(wk,purchaseorderdate) as weekno
,dateadd(dd,0,datediff(dd,0,purchaseorderdate-(datepart(weekday,purchaseorderdate)-1)+1)) as newdate,grandtotal
from tblpurchaseorder where purchaseorderdate<=getdate()) as tbl group by weekno,newdate
Here I have subtracted 1 from (weekday,purchaseorderdate) to
make it start from monday (default for monday will be 2).
and the whole equation gives monday of that week.
please try it and tell me if that is what you need.