COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Sep2013 on 14 Aug 2013 12:01:50 AM

Title: usin set functions in case statement
Post by: Sep2013 on 14 Aug 2013 12:01:50 AM
Hi,

i have a requirement where i am using a dimensional model.
I have a product attribute called product group.
I want to use that attribute to filter the products accordingly.
I have 1 prompt for product group and second cascaded prompt for products.
Now, since i do not have levels in hierarcy i am using set function as below for second prompt


case
?Parameter1?
when 'Internet' then
set ([ADSL - Bundle Proxy (LSS)],[ADSL - Bundle proxy (Off-net)])
when 'Hardware' then 'Ab' End

Now, this works fine, but if i add one more "When" in case statement inclusing set function, it doesnt work.
can anyone help me in this.
Title: Re: usin set functions in case statement
Post by: MFGF on 14 Aug 2013 03:33:38 AM
Hi,

Assuming Group is an attribute of each product member on your Products level, why not just do the following:

filter([Your Products level], [Your Group attribute] = ?Parameter1?)

No need for a case statement :)

(This would be a calculated item in the query driving your Product prompt)

Cheers!

MF.
Title: Re: usin set functions in case statement
Post by: Sep2013 on 14 Aug 2013 06:50:03 AM
But there is no concept of levels in hierarchy, and there are about 100 products. So can i drag and drop all the products in the formula?
Title: Re: usin set functions in case statement
Post by: Sep2013 on 14 Aug 2013 10:55:51 PM
That worked! But now the problem is that it is not necessary that all products will lie at a specific level, it may be level 4,5,6. So the step 1., doesnt work as it will fetch me only the "Level5" memebers. is there any way i can fetch the leaf memebers of a hierarchy?

Steps:
1.   Fetch the leaf members using the following function:
descendants ([Total Without Interest],3): The [Total Without Interest] is 'level 2' and this expression gets all the members in 'level 5' independent of the 'level 3' and  'level 4'.

2.   Then use the following function:
filter([Data Item2],[Product_Group]=?Parm1?): This expression filters the members from step 1, according to the "Product_Group" attribute (which is equal to the group selected in the "Product Group" prompt.
Title: Re: usin set functions in case statement
Post by: MFGF on 16 Aug 2013 05:15:52 AM
Hi,

I'm not quite clear on your requirement here, sorry. What levels does the hierarchy have? What rules do you need to be able to retrieve the desired members?

MF.