COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Benjamin80 on 18 Mar 2015 02:52:17 AM

Title: using case when with cubes
Post by: Benjamin80 on 18 Mar 2015 02:52:17 AM
Hello,

I'm new to the forum and I was hoping somebody could help me with my problem.
Since a few months I'm using BI cognos, so let's say I'm a rookie on this matter.

I have made a crosstab based on a cube with following info:




Year-1YearDifference
Month

I've dragged a measure in it and everything works fine.
Now to show you what my problem is I'll try to post an example of the table:





Year-1YearDifference
Jan105-5
Feb10

So the first line is ok, bit the problem is when there's no value available I don't get a subtraction result.

I've tried to use a case when like this
case [Y]
   WHEN null THEN -[Y-1]
   ELSE [Y]-[Y-1]
end


but I get following error:
In a Parent-Child hierarchy, a category can have only one parent.

Any ideas what's wrong with the method I use? Any advice or suggestions are welcome.
Thanks in advance for the help.

Benjamin


Title: Re: using case when with cubes
Post by: Benjamin80 on 20 Mar 2015 02:38:37 AM
Hello, I found a solution for my problem. I think the problem for me is still thinking in dimensions.

So I adapted the Y and Y-1 items like this:

if(tuple([MemberYear];currentmeasure) is null ) then (0) else (tuple([MemberYear];currentmeasure))

Perhaps this solution helps somebody else.

Best regards,

Benjamin