COGNOiSe.com - The IBM Cognos Community

Legacy Business Intelligence => COGNOS ReportNet => Report Studio => Topic started by: ADW on 23 Oct 2007 05:08:26 PM

Title: Calculation Expression--HELP!
Post by: ADW on 23 Oct 2007 05:08:26 PM
I have been trying to figure this out for weeks with no luck. Unfortuantely, due to my mind thinking in Excel term versus Cognos 8 ReportNet terms, I need assistance figuring out how to create and represent an expression in a Report I'm creating. I have a column from a DB I'm mapping to that has integer data representing a duration of time. What the end user wants is a conditional expression that does the following

IF [package].
.[data-item]>=7

   THEN (Count([package].
.[data-item])/(Count(Rows))

Seems simple enough, but:

  1) How or Where would I place that expression in a cell/column/page by itself
  2) I keep getting parsing errors when I try to do a count of [package].
.[data-item]>=7
  2) I can't get the expression to validate nor can I get half of the condition to validate and keep getting parsing errors.

Thanks in advance!
Title: Re: Calculation Expression--HELP!
Post by: rockytopmark on 23 Oct 2007 05:59:36 PM
Keep it simple...  Set the value to 1 if it meets the criteria or 0 if not.

Then simply let the aggregation handle the math.

Create a Query Item, "7 or better":
IF ([package]..[data-item]>=7) THEN (1) ELSE (0)

Then to get your ratio, divide the count of the rows by this query item.

This of course will not make much sense in a detail report, but in a summarized report (where there is some level of grouping and therefore, some aggregation) it will get you your result.
Title: Re: Calculation Expression--HELP!
Post by: ADW on 23 Oct 2007 07:27:16 PM
Thanks, I will give that a try.