当前位置: 代码迷 >> PB >> 很简单的DW的有关问题,帮解决了马上给分
  详细解决方案

很简单的DW的有关问题,帮解决了马上给分

热度:90   发布时间:2016-04-29 06:50:42.0
很简单的DW的问题,帮解决了马上给分
grid风格的dw
ybh   xs
123   2
123   2
123   2
456   1
456   1
789   4
789   4
TOTAL:2+1+4=7

如何在下面的汇总里统计出xs这列按ybh分组后的和,即2+1+4=7
我这样写的:sum(xs for all) ,可结果却是2+2+2+1+1+4+4,想去掉重复,该怎么写这个汇总函数呢

------解决方案--------------------
在表达式里面这样写试下:sum(if(getrow()= 1 or xs <> xs[-1],xs,0) for all)
------解决方案--------------------

右边写你的计算域
先分组 sum(  contract_comesthefunds  for group 1 )
再统计 sum(xs for all)
------解决方案--------------------
sum(xs for all DISTINCT)
------解决方案--------------------

看帮助 Sum DataWindow expression function
Sum ( column { FOR range { DISTINCT { expres1 {, expres2  {, ... } } } } } )

Assuming a DataWindow object displays the order number, amount, and line items for each order, this computed field returns the sum of the order amount for the distinct order numbers:

Sum(order_amt for all DISTINCT order_nbr)


------解决方案--------------------
计算域,表达式为:sum(xs for all distinct)
  相关解决方案