MDX <member>.ANCESTORS recursively

Post Reply
Lukas Meyer
Posts: 51
Joined: Thu Jul 24, 2008 6:14 am

MDX <member>.ANCESTORS recursively

Post by Lukas Meyer »

Hello,

<member>.ANCESTORS just does a tiny part of the work I would like it to do ^^
I want all ancestors of a given element - and there will be many parallel-hierarchies. Does anyone have a solution for this? (it will be needed for about 1,5k elements - so a recursive process could be annoying :) )

Thanks in advance,
Lukas

PS.: I still hate the "Save"-button, I really, really hate it :evil:
Lukas Meyer
Posts: 51
Joined: Thu Jul 24, 2008 6:14 am

Re: MDX <member>.ANCESTORS recursively

Post by Lukas Meyer »

Well, I got myself a solution.
It may not be the best, but it works.

{stupid junk removed}

I built a dimension which has exactly the same elements as the one I'm analyzing - but no hierarchy at all.
Then a cube, using both the dimensions.
Added this rule:
[] = IF( !DIM @= !DIM_MIRROR,1, continue);
[] =CONSOLIDATECHILDREN('DIM');

Now I can get all parents by using this MDX-Statement:
{FILTER( {TM1SUBSETALL( [DIM] )},
}SYS_CUBE.[DIM_mirror].[ELEMENT_TO_LOOK_UP] > 0
)}

Any better solutions out there?

PS.: I seem to be getting used to the friendly save button...
PSS.: When I'm tired I don't work very well...
User avatar
Steve Rowe
Site Admin
Posts: 2416
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: MDX <member>.ANCESTORS recursively

Post by Steve Rowe »

Nice approach Lukas, I'd probably would have used ElisAnc where you have the continue.

[] = IF( !DIM @= !DIM_MIRROR,1, ElIsAnc ( 'Dim', !DIM_MIRROR, !DIM));

I might have the two !Dim references the wrong way round. Other than that not much to add.

Cheers,
Technical Director
www.infocat.co.uk
Lukas Meyer
Posts: 51
Joined: Thu Jul 24, 2008 6:14 am

Re: MDX <member>.ANCESTORS recursively

Post by Lukas Meyer »

Yeah, it should be
[] = IF( !DIM @= !DIM_MIRROR,1, ElIsAnc ( 'Dim', !DIM, !DIM_Mirror));

How much better is it? I tested it - but there was no difference :)

Lukas.

PS: I hate the button again - I won't mention which - the one I refer to knows very well itself... ( I just hit it :lol: )
Post Reply