COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: deepak2k2 on 09 Nov 2010 02:13:36 AM

Title: Dynamic filter and measures
Post by: deepak2k2 on 09 Nov 2010 02:13:36 AM
Hi,

My scenario is I need a create a static choices in Value Prompt.  Based on my selection, the table should filter with my dimension and display a different measure.  For each selection filter and measure should change.  

Ex:  If I select 'a' in my prompt, it should filter by dimension (Accessories->Phone) and then display measure "Sales".  If i select 'b', then filter by dimension (Accessories->Computer), measure "Count".

Please give suggestions to solve it.
Title: Re: Dynamic filter and measures
Post by: CognosPaul on 09 Nov 2010 02:46:21 AM
The easiest way to do this:

The prompt should return the MUN of whatever members you want. For the purpose of this example the parameter name is SlicerMUN. Make sure it has a default value of something.

Drag a Slicer Member Set to the slicer in the query, and give it the following expression: #prompt('SliceMUN','token')#

The data item that contains the measure should have the following expression:

case #sq(prompt('SliceMUN','token'))#
when '[Cube].[Dim].[Hier].[Level]->[Computer]' then [Measures].[Count]
when '[Cube].[Dim].[Hier].[Level]->[Phone]' then [Measures].[Sales]
else [Measures].[Whatever]
end