COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: HERRERA on 22 Jan 2008 11:48:06 AM

Title: Case statement
Post by: HERRERA on 22 Jan 2008 11:48:06 AM
Hi, i have a calcutated field with "total for" , using a case statement, but my expression does not function.

The expression :

Case
When [metric_id1] = 999
Then Total ([value] for [bsc_name])
Else [value]
End


The result is ignoring the filter.

Its possible use "total for" with "case" ???


Tks
Herrera
Title: Re: Case statement
Post by: Suraj on 22 Jan 2008 12:11:56 PM
Can't say why it's not working, everything looks okay.
Try reversing the condition.
Case
When [metric_id1] <> 999
Then [value]
Else Total ([value] for [bsc_name])
End
Title: Re: Case statement
Post by: HERRERA on 22 Jan 2008 12:33:29 PM
Quote from: Suraj Neupane on 22 Jan 2008 12:11:56 PM
Can't say why it's not working, everything looks okay.
Try reversing the condition.
Case
When [metric_id1] <> 999
Then [value]
Else Total ([value] for [bsc_name])
End


Did not function........ :(




Title: Re: Case statement
Post by: Suraj on 22 Jan 2008 12:39:44 PM
then create a data item that only calculates total for 999:
Data item1:
Case
When [metric_id1] = 999
Then Total ([value] for [bsc_name])
Else  null
End
This should work fine. It not, then you have other issues.
After this is working create another data item to use in report.
Data item2:
case When [metric_id1] = 999
Then [Data item1]
Else  [value]
End
Try different approaches and start from a simple calculation, check the data and then proceed by adding complexity.
Title: Re: Case statement
Post by: HERRERA on 23 Jan 2008 05:43:52 AM
Ok, tks for help !!!!!