Cognos相当于excel的sumif()函数

Fra*_*nal 4 cognos totals cognos-8 sumifs cognos-10

我熟悉Excel和SQL,但对Cognos不熟悉.我正在[Total Margin]为每个人做一个有条件的总和[Item Code].此结果应显示在每一行的每一行上.我在Cognos中尝试了两种方法,并在Excel中进行了概念验证.请参阅下面的单个样本数据[Item Code].

数据截图

总项目保证金A(Cognos)

case
when [free of charge flag] = 'FALSE'
then total([Total Margin] for [Item Code])
else null
end
Run Code Online (Sandbox Code Playgroud)

这里的问题是TOTAL结果不正确,并且无法显示在第2行.

总项目保证金B(Cognos)

total([Total Margin] for [Item Code],[free of charge flag])
Run Code Online (Sandbox Code Playgroud)

这里TOTAL结果在大多数行上是正确的,但在第2行上是不同的.

总项目保证金C(Excel)

=SUMIFS([Total Margin],[Item Code],'10001430',[free of charge flag],FALSE)
Run Code Online (Sandbox Code Playgroud)

所以我可以使用excel SUMIFS公式得到我想要的结果.我需要编写哪些Cognos查询才能直接从Cognos获得相同的结果?

小智 5

尝试

total(
  case
  when [free of charge flag] = 'FALSE'
  then [Total Margin]
  else null
  end
for [Item Code])
Run Code Online (Sandbox Code Playgroud)