COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: ernareshpatel on 18 Nov 2014 06:24:16 AM

Title: Get Associated Parent Value at each level Cognso DMR Report
Post by: ernareshpatel on 18 Nov 2014 06:24:16 AM
Hi,

We are working on Cognos DMR. I have dimesnion hierarchy as defined below and have four levels in the hierachy.

- Hierarchy
- Hierarchy All
   - Level 1 (Country)
   - Level 2 (State)
   - Level 3 (Regin)
   - Level 4 (City)
   
We have drill down report and displaying Level 1 at first and then drill down to Level 2 -> Level 3 -> upto Level 4 and same way drill up from Level 4 -> Level 3 -> Level 2 -> up Level 1.

Now I need parent value of the memeber at each level starting from Level 2.

e.g. For a given State get the value of its associated Country name (parent) at level 2.

Please share your ideas.

Thanks,
Naresh
Title: Re: Get Associated Parent Value at each level Cognso DMR Report
Post by: bdbits on 18 Nov 2014 09:02:55 AM
You may be looking for the parent() function. For example, parent([Orange County]) would give you [California].
Title: Re: Get Associated Parent Value at each level Cognso DMR Report
Post by: ernareshpatel on 18 Nov 2014 10:26:34 PM
Hi,

I know how Parent() function works, but you need to pass the member or measure inside. In my scenario don't have fixed value of member, it depends on what value you have selected on the first level.

Parent([Orange County]) works in the condition where you have fixed member value for which you are going to get parent value.

Thanks,
Naresh
Title: Re: Get Associated Parent Value at each level Cognso DMR Report
Post by: CognosAnalytics on 19 Nov 2014 02:20:50 PM
Hello Ernareshpatel,
In your query drag and drop the Country level twice, Lets say we call them [Country] and [Country1].
In your page where you are trying to display the parent of the member which you are drilling up/down on, drag and drop the items. For example, if you are using a list, drag and drop [Country1] in the list columns, and [Country] in the list header, or another column, depending on where you want to display the parent of the member.
Next, got to Data > Drill behavior, click on Advanced tab.
Click on [Country] data item, set the Drill-up behavior to "Replace Item". Same for Drill-down behavior i.e. "Replace Item".

Run the report, and do the drill up and down. You will see as you drill down/up the value of the [Country] data items shows the parent of the data item [Country1] which is the one you are drilling on.

Let me know if it works out for you.

-Cognos810
Title: Re: Get Associated Parent Value at each level Cognso DMR Report
Post by: ernareshpatel on 25 Nov 2014 05:27:14 AM
Hi,

I don't  want to display the parent value on screen. I want to have in data item which I can append or use in any other data item.

e.g. Data Item 1  = Parent([State]).

Thanks
Title: Re: Get Associated Parent Value at each level Cognso DMR Report
Post by: Lynn on 25 Nov 2014 10:39:22 AM
How about using the currentMember function within the parent function?

parent ( currentMember ( [Your Hierarchy] ) )
Title: Re: Get Associated Parent Value at each level Cognso DMR Report
Post by: ernareshpatel on 28 Nov 2014 01:02:02 AM
HI,

@lynn:

Receiving error message.

XQE-PLN-0093

The argument at position 1 of 'currentMember' from the data item 'Data Item1' is a 'level' expression, which cannot be coerced into a 'hierarchy' expression

Thanks,
Naresh
Title: Re: Get Associated Parent Value at each level Cognso DMR Report
Post by: MFGF on 28 Nov 2014 05:06:46 AM
Quote from: ernareshpatel on 28 Nov 2014 01:02:02 AM
HI,

@lynn:

Receiving error message.

XQE-PLN-0093

The argument at position 1 of 'currentMember' from the data item 'Data Item1' is a 'level' expression, which cannot be coerced into a 'hierarchy' expression

Thanks,
Naresh

Well, it sounds to me like you failed to follow the instructions Lynn provided. We can't be sure, though, because you didn't tell us what expression you used. Lynn indicated your expression should be of the form:

parent ( currentMember ( [Your Hierarchy] ) )

Where she states [Your Hierarchy], this should be your hierarchy, and not a level from your hierarchy.

Cheers!

MF.