数据窗口里的统计解决办法

数据窗口里的统计
在数据窗口里有如下字段及数据(定义code为组:group 1):
code quantity type
0001 10 入仓
0001 20 出仓
0001 10 入仓
0001 20 入仓
0002
...
0003
...
增加一计算列
用以下SUM可以统计0001组的入仓的数为:40
sum(if(type='入仓',0,quantity) for group 1)
=40

但我现想统计以组的入仓的个数时,就不知这语句如何写???
count(if(type='入仓',?,?) for group 1)
结果为3
请教!

------解决方案--------------------
sum(if(type='入仓',0,1) for group 1)