COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Dinok on 09 May 2014 04:29:19 AM

Title: Dimensional Filter on Tuple
Post by: Dinok on 09 May 2014 04:29:19 AM
I have been trying to avoid a detail filter on a crosstab using OLAP.  The crosstab is :

                   2001     2002     2003
prod 1           20         30         22
prod 2           30          5            7
prod 3           11          22         12

I only want numbers over 20, so the reult should be :

   QTY          2001       2002      2003
prod 1                          30         22
prod 2          30
prod 3                           22

A detail filter works fine, but best practice and all that!

I have tried the filter function filter(product, tuple(currentmember(time),qty>20) but it isn't working.
I have also tried currentmember for rows and columns.

Please help!
Title: Re: Dimensional Filter on Tuple
Post by: willg on 09 May 2014 05:11:34 AM
Would a case statement solve your requirement? eg.

case when [qty] > 20 then [qty] else null end

Title: Re: Dimensional Filter on Tuple
Post by: Dinok on 09 May 2014 06:04:52 AM
Thanks Willg,  I guess it would.  Is it as efficient as using the filter statement?

Title: Re: Dimensional Filter on Tuple
Post by: Lynn on 09 May 2014 07:55:32 AM
Quote from: Dinok on 09 May 2014 04:29:19 AM
I have been trying to avoid a detail filter on a crosstab using OLAP.  The crosstab is :

                   2001     2002     2003
prod 1           20         30         22
prod 2           30          5            7
prod 3           11          22         12

I only want numbers over 20, so the reult should be :

   QTY          2001       2002      2003
prod 1                          30         22
prod 2          30
prod 3                           22

A detail filter works fine, but best practice and all that!

I have tried the filter function filter(product, tuple(currentmember(time),qty>20) but it isn't working.
I have also tried currentmember for rows and columns.

Please help!

Your filter function is looking to remove entire product rows based on the condition. You can't filter out any product rows because all are needed for at least one of the time periods.

You could also try a conditional style on the intersection CellValue() < 20 and then hide the value via styling.

Title: Re: Dimensional Filter on Tuple
Post by: CognosPaul on 09 May 2014 08:20:46 AM
What are you trying to achieve by hiding values below the threshold? Is it for the purposes of display, or will you need to perform a calculation on them? Hiding the value from the page will not remove those values from future calculations.


If you do need to hide the values on the query level, you can modify the measure to something like if(tuple(measure,currentMember(hier),currentMember(hier))>20) then (null) else (measure)

The benefit of doing that is you can continue to slice further down on those values. So whole prod1, 2013 is 30, each quarter may be under the 20 min. A detail filter  will remove them while the if statement will not.