用跨表统计的方式,参考
http://www.foxtable.com/webhelp/scr/1454.htm
统计的时候,加上日期条件,如
e.DataRow("数量") = DataTables("订单").Compute("Sum(数量)","[产品] = '" & e.NewValue & "' and [购买时间] >= #1/1/2017# And [购买时间]<= #12/31/2017#")