dbTalk Databases Forums  

MDX: Child of current member with the same name as the current member

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss MDX: Child of current member with the same name as the current member in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
James Taylor
 
Posts: n/a

Default MDX: Child of current member with the same name as the current member - 07-07-2004 , 06:26 AM






Please put me out of my misery.

I need to get hold of the child of the current member that has the same name
as the current member and I'm struggling.

Why is it that this works:

[SalesPerson].CurrentMember.Children("Central"))

but not this:
[SalesPerson].CurrentMember.Children(MemberToStr([SalesPerson].CurrentMember
))

or this:
[SalesPerson].CurrentMember.Children(([SalesPerson].CurrentMember.Name))

I promise you that there is a member with the name "Central" in both levels!

Thanks in advance



Reply With Quote
  #2  
Old   
James Taylor
 
Posts: n/a

Default Re: MDX: Child of current member with the same name as the current mem - 07-07-2004 , 12:51 PM






Thanks for the reply Brian but this didn't work for me.

Any other ideas anyone?

Please?!

"Brian Altmann" <findme@thesignaturewebsite> wrote

Quote:
You might try:

[SalesPerson].CurrentMember.Children( "[Child Level Name]." +
[SalesPerson].CurrentMember.Name)

HTH,
--
Brian
www.geocities.com/brianaltmann/olap.html


"James Taylor" wrote:

Please put me out of my misery.

I need to get hold of the child of the current member that has the same
name
as the current member and I'm struggling.

Why is it that this works:

[SalesPerson].CurrentMember.Children("Central"))

but not this:

[SalesPerson].CurrentMember.Children(MemberToStr([SalesPerson].CurrentMember
))

or this:
[SalesPerson].CurrentMember.Children(([SalesPerson].CurrentMember.Name))

I promise you that there is a member with the name "Central" in both
levels!

Thanks in advance






Reply With Quote
  #3  
Old   
Coen
 
Posts: n/a

Default Re: MDX: Child of current member with the same name as the current member - 07-07-2004 , 02:35 PM



What about

Filter([Sales Person].CurrentMember.Children,
[SalesPerson].CurrentMember.Name =
[SalesPerson].CurrentMember.Parent.Name)

HTH,

Coen


Reply With Quote
  #4  
Old   
James Taylor
 
Posts: n/a

Default Re: MDX: Child of current member with the same name as the current member - 07-08-2004 , 09:57 AM



Thanks but this is not quite what I want.

This is testing the current member name against the parent member name,
whereas I want to compare the current member name against all the children.
And not being able to loop through each of the children I am well and truly
stuck.

"Coen" <stumpie at xs4all dot nl> wrote

Quote:
What about

Filter([Sales Person].CurrentMember.Children,
[SalesPerson].CurrentMember.Name =
[SalesPerson].CurrentMember.Parent.Name)

HTH,

Coen




Reply With Quote
  #5  
Old   
Coen
 
Posts: n/a

Default Re: MDX: Child of current member with the same name as the current member - 07-11-2004 , 01:09 PM



On Thu, 8 Jul 2004 15:57:42 +0100, "James Taylor" <a@b.com> wrote:

Quote:
Thanks but this is not quite what I want.

This is testing the current member name against the parent member name,
whereas I want to compare the current member name against all the children.
And not being able to loop through each of the children I am well and truly
stuck.
As fas as I know, this doesn't test the current member. I use a
similar function to hunt down a member that has a member property set
by the back-end system. Don't get fooled by the CurrentMember in the
filter statement. I'm pretty sure it'll do the trick. Just try it.
Either way, one of us will learn something :-)

Coen



Reply With Quote
  #6  
Old   
James Taylor
 
Posts: n/a

Default Re: MDX: Child of current member with the same name as the current member - 07-13-2004 , 08:27 AM



Hi Coen,

I did try this with no success. Let me give some more details: I have a very
simple cube containing a "SalesPerson" dimension with levels: Country,
Brokerage, Sales Person.

For some measures in the cube I want to aggregate the dimension in the
normal way (SUM of children) whereas for other measures - percentages - I
don't want to aggregate, instead I want to use the specific value of the
child of the current member that has the same name as the current member.

So, in the Custom Rollup formula of both the Country and Brokerage levels,
using your Filter code I have:

Iif([Measures].CurrentMember.Name="PercentMeasure1" or
[Measures].CurrentMember.Name="PercentMeasure2",
Filter([SalesPerson].CurrentMember.Children,
[SalesPerson].CurrentMember.Name = [SalesPerson].CurrentMember.Parent.Name),
Sum([SalesPerson].CurrentMember.Children))

This gives me the following error in each member cell of the higher levels:
"Formula error - syntax error - token is not valid:
"Filter([SalesPerson].CurrentMember.Children,
[SalesPerson].CurrentMember.Name=[SalesPerson].CurrentMember.Parent.Name)^,^
Sum([SalesPerson].CurrentMember.Children))"

The middle bit is the problem! You can see why I came up with this first:
[SalesPerson].CurrentMember.Children(([SalesPerson].CurrentMember.Name))

If you have any more suggestions I'd love to hear them.

Thanks!



Reply With Quote
  #7  
Old   
Sanka
 
Posts: n/a

Default RE: MDX: Child of current member with the same name as the current mem - 07-18-2004 , 12:29 AM



Hi James,

A similar problem is discussed here...

http://blogs.msdn.com/bi_systems/articles/162850.aspx
(Comparing CURRENTMEMBER From Different Contexts )

Guess with little fine tuning u can solve yours... Hope this helps...

Cheers,
Sanka

"James Taylor" wrote:

Quote:
Please put me out of my misery.

I need to get hold of the child of the current member that has the same name
as the current member and I'm struggling.

Why is it that this works:

[SalesPerson].CurrentMember.Children("Central"))

but not this:
[SalesPerson].CurrentMember.Children(MemberToStr([SalesPerson].CurrentMember
))

or this:
[SalesPerson].CurrentMember.Children(([SalesPerson].CurrentMember.Name))

I promise you that there is a member with the name "Central" in both levels!

Thanks in advance




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.