以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  如何求月或者年平均销量  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=45422)

--  作者:wuxianzuoji41
--  发布时间:2014/1/24 20:31:00
--  如何求月或者年平均销量
如何求月或者年平均销量?去掉其中的周六日的
--  作者:有点甜
--  发布时间:2014/1/24 21:24:00
--  
 代码例如

dim sum as double
dim count as integer
for each dr as datarow in Datatables("xxx").select("日期 >= #01/01/2014# and 日期 < #02/01/2014#")
    if dr("日期").DayOfWeek <> 6 andalso dr("日期").DayOfWeek <> 0 then
        sum += dr("数量")
        count += 1
    end if
next

msgbox(sum / count)