SubsetCreatebyMDX - remove negatively weighted elements

Post Reply
jed
Posts: 62
Joined: Wed Sep 02, 2009 11:33 am
OLAP Product: TM1
Version: PA 2.0.9.4
Excel Version: 2016
Location: Australia

SubsetCreatebyMDX - remove negatively weighted elements

Post by jed »

All of my cubes have drill through to cube detail setup.

I use a fairly generic MDX expression to expand consolidated elements to the lowest level where DTYPE returns C (consolidated element):
MDXString='{TM1FILTERBYLEVEL( {DESCENDANTS([' | MyDim | '].[' | Account | ']) }, 0)}';

This works really well except where consolidations have negative weightings which results in the children of any negatively weighted consolidations being included in the subset twice instead of being excluded altogether.

So I'm trying to work out a way to exlude the DESCENDANTS of any consolidations with a negative weighting.

To my knowledge you cannot refer to element "Weight" as if it were an attribute which could be used in FILTER??
I also thought that if a could do a COUNT on all N Level elements then maybe I could exclude anything where the count was greater than 1.

Can anyone think of a simple way to solve deal with this situation? If I cannot use MDX then I guess I could do some more detailed processing through the TI inserting elements into temporary subsets etc.

cheers
jed
standtrue
Posts: 25
Joined: Sat Nov 07, 2009 5:37 am
OLAP Product: TM1, CX
Version: 9.5.2
Excel Version: 2007

Re: SubsetCreatebyMDX - remove negatively weighted elements

Post by standtrue »

Jed,

I'm a TM1 "white belt" so to speak, so this might not be the best way to achieve this, but you can add a new element attribute (say, called "RuleWeight") and add a rule to the }elementattributes_dimname cube like:

['RuleWeight'] =s:str(ELWEIGHT('dimname', elpar('dimname',!dimname,1), !dimname),1,0);

then you can filter your subset using this attribute (note that it could also be a numeric attribute):

{FILTER( {TM1SUBSETALL( [dimname] )}, [dimname].[RuleWeight] <> "0")}
Post Reply