COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: kado on 27 Apr 2010 06:50:02 PM

Title: IF THEN - 8.4 - cube source
Post by: kado on 27 Apr 2010 06:50:02 PM
Hello,

I have a crosstab with 2 dimensions (Relative Time and Version) within the columns and multiple custom measures (built in Framework Manager) for Rows. I want to add a multiplier to 1 of the specific line items ('Stock Comp') when a particular version is 'Plan'. So basically if it is 'Plan' show me the custom measure times 1.5 ELSE show me 'Stock Comp'.

if
([Version]='Plan')
then
([Stock Comp]*1.5)
else
([Stock Comp])

I tried creating a calculated member (as well as measure) but keep getting errors.

Any thoughts?

thanks,
kado
Title: Re: IF THEN - 8.4 - cube source
Post by: SSNCOG on 27 Apr 2010 11:47:47 PM

can you share the error you're getting?
Try using CASE statement.

Cheers
SSNCOG
Title: Re: IF THEN - 8.4 - cube source
Post by: kado on 28 Apr 2010 01:09:34 PM
Here is the Error:

  Invalid coercion from 'member' to 'string' for '[VERSION-SCENERIOS]' in 'if ([VERSION-SCENERIOS] = 'Actual') then ([SC, 401k, ESOP]) else ([SC, 401k, ESOP] * 1.5)'.

My hierarchy actually has another folder under [VERSION-SCENERIOS] for [1-Approved] so I tried using that without luck. I also tried using a CASE and got the same error.

Any other thoughts?

thanks,
kado
Title: Re: IF THEN - 8.4 - cube source
Post by: kado on 28 Apr 2010 01:15:47 PM
What seems a little odd is if I add double quotes around "Actual" ... I get:

'Parsing error before or near position'
Title: Re: IF THEN - 8.4 - cube source
Post by: MFGF on 29 Apr 2010 02:27:27 AM
Hi,

Can you try the following:

if (caption([VERSION-SCENERIOS]) = 'Actual') then ([SC, 401k, ESOP]) else ([SC, 401k, ESOP] * 1.5)

Cheers!

MF.
Title: Re: IF THEN - 8.4 - cube source
Post by: kado on 29 Apr 2010 11:55:18 AM
Awesome!!! Thanks for the feedback, I was missing that caption piece!

;D