Page 1 of 1

MDX <member>.ANCESTORS recursively

Posted: Thu Nov 13, 2008 5:15 pm
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:

Re: MDX <member>.ANCESTORS recursively

Posted: Thu Nov 13, 2008 5:49 pm
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...

Re: MDX <member>.ANCESTORS recursively

Posted: Thu Nov 13, 2008 7:32 pm
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,

Re: MDX <member>.ANCESTORS recursively

Posted: Thu Nov 13, 2008 8:00 pm
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: )