COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Dineshpullagura on 05 Feb 2015 10:58:09 AM

Title: equals to operator not working in filter expression
Post by: Dineshpullagura on 05 Feb 2015 10:58:09 AM
Hello,

I am using cube as my data source for reporting. I have a dimension with level keys from -5 to 40. In the report i want to filter the output on two keys.
I tried the following expression

[Cube].[Dimension].[Hierarchy].[Level].[Level-Key] = -5 and 
[Cube].[Dimension].[Hierarchy].[Level].[Level-Key] = 42

But this expression didn't return any rows. I tried another expression

[Cube].[Dimension].[Hierarchy].[Level].[Level-Key] >=-5 which technically returns all the rows. This expression is working.

Is there any limitation with equals to in dimensional reporting or something wrong with the expression.

Looking forward for your suggestions.

Thank you
Title: Re: equals to operator not working in filter expression
Post by: Karti on 05 Feb 2015 12:15:24 PM
If you only want to show the output for -5 and 42 in your report, you will want to use 'or' instead of 'and'. Putting in 'and' would mean that the Level-Key would be both -5 and 42, which isn't what you are looking for, correct?

Please try using 'or' and let me know if that works out for you.
Title: Re: equals to operator not working in filter expression
Post by: Dineshpullagura on 05 Feb 2015 12:23:32 PM
Hi,

I tried using just one expression like this

[Cube].[Dimension].[Hierarchy].[Level].[Level-Key] = -5, it still didn't work. And i tried using or too, but no luck.
Title: Re: equals to operator not working in filter expression
Post by: MFGF on 05 Feb 2015 12:44:39 PM
Quote from: Dineshpullagura on 05 Feb 2015 12:23:32 PM
Hi,

I tried using just one expression like this

[Cube].[Dimension].[Hierarchy].[Level].[Level-Key] = -5, it still didn't work. And i tried using or too, but no luck.

Hi,

Are you building a detail filter for this? If so, it's absolutely the wrong thing to do. Are you showing the two members in question in your report? If so, just drag in the members from the package tree - no filter required. If not, go to the query and define a slicer - drag in a slicer member set and populate this with the two members in question.

Cheers!

MF.