+ -
当前位置:首页 → 问答吧 → 帖子上移 如何在Access中实现以下计算,谢谢请看附件

帖子上移 如何在Access中实现以下计算,谢谢请看附件

时间:2011-05-26

来源:互联网

如何在Access中实现以下计算,每月自动计算年累计GOP%,后当月GOP * 相应的Fee% - 上月的预提Fee,

结果为 年累计Fee = 年累计GOP * 相应的Fee%.

请看附件

Month        Revenue        GOP        GOP%        Fee                Fee        Fee%        GOP
1        10000        1000        10.0%        50                        5.0%        0.0%
2        12000        2000        13.6%        100                        6.0%        30.0%
3        13500        7000        28.2%        350                        7.0%        40.0%
4        14000        2000        24.2%        100                               
5        8000        3000        26.1%        150                               
6        50000        30000        41.9%        2400

附件

Fee Cal.rar(1.77 KB)

2011-5-26 14:54, 下载次数: 4

作者: felixtian   发布时间: 2011-05-26

为了简化查询,分拆之(不用能%,改了):
一、select month,revenue,gop,
((select sum(gop) from tb where month<=a.month)/(select sum(revenue) from tb where month<=a.month)) as [gop%]
from tb a
二、select month,revenue,gop,[gop%],
iif([gop%]<0.30,0.05,iif([gop%]<0.40,0.06,0.07))*(select sum(gop) from tb where month<=a.month) as Freet
from 查询一 a
三、select month,revenue,gop,[gop%],
Freet-(select max(Freet) from 查询二 where month<a.month) as Free
from 查询二 a

[ 本帖最后由 marco 于 2011-5-26 17:39 编辑 ]

作者: marco   发布时间: 2011-05-26