Cognos equivalent excel sumif () function

I am familiar with Excel and SQL, but new to Cognos. I fulfill the notional amount [Total Margin]

for each [Item Code]

. This result should be displayed on every line for every item. I've tried 2 approaches in Cognos and a proof of concept in Excel. Below are examples of data from one [Item Code]

.

data screenshot

Item A Total Margin (Cognos)

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

      

The problem here is that the TOTAL result is incorrect and just doesn't appear on the second line.

Item B Total Margin (Cognos)

total([Total Margin] for [Item Code],[free of charge flag])

      

Here the TOTAL result is correct for most lines, but differs on the second line.

Total position size C (Excel)

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

      

So I can get the result, I want to use excel SUMIFS formula. What Cognos query do I need to write to get the same result directly from Cognos?

+3


source to share


1 answer


try it



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

      

+5


source







All Articles