COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: sanchoniathon on 12 Jul 2010 10:02:54 AM

Title: Calculated Data Item
Post by: sanchoniathon on 12 Jul 2010 10:02:54 AM
Hi to all,

We want to be able to calulate [SALES] of a certain sub-department divided over the total of that DEPARTMENT.

We need to have this done dynamically depending on the values of the SUB-DEPARTMENT and DEPARTMENT parameters choosen by the user.

Is this possible or not ? This is what i think might do what i want but can't seem to make it work correctly:

currentMember ( [Cube_Sales].[ProductDimension].[Produit_Level] )
/
parent ( currentMember ([Cube_Sales].[ProductDimension].[Produit_Level] )

Thanks !
Title: Re: Calculated Data Item
Post by: cognos_share on 16 Jul 2010 01:21:21 PM
Hi

I am not sure about your logic, but if I understand what you are looking for is in Reports Studio then here is what i suggest...

Create a  data item (DT1) that picks up the parameter and calcs Total(Department)

and another data item (DT2) that picks ups the parameter for sub-department and calculate Sub-department/DT1.

Bring both data items on the page and in the prompt page pass on the parameters for Department and Sub-department.
Title: Re: Calculated Data Item
Post by: laks on 17 Jul 2010 02:56:20 PM
I am not sure about better solution, on top of my mind i would think of creating two different queries Query1 which contains department and sub-department parameters and Query2 which contains only department parameter. Join these two query's to create a main query which contains [Query1].[SALES]/[Query2].[SALES]
Title: Re: Calculated Data Item
Post by: sanchoniathon on 28 Jul 2010 01:26:43 PM
Hi to all,

Did not tested what was suggested but with i finally got to get what i wanted.
This is what needs to be in my Data Item expression:

(tuple ( [Cube_Sales].[ProductDimension].[Produit_Level] ->?pVision?, [Sales] ) /
tuple ( parent ( [Cube_Sales].[ProductDimension].[Produit_Level] ->?pVision?), [Sales] ) ) *100

The important portion of this expression is the parent() function.

Thanks anyhow !