Page 1 of 1
Count of Leaf
Posted: Fri Aug 13, 2010 11:22 pm
by tryinghard
Hello,
I have a dimension with multiple levels (5) in it, I would like to count the number of leaf levels in the dimension. I cannot use ELCOMPN because it gives the count of the children and not leafs (i.e. child of child) in other words great grand child count etc.
I tried creating an attribute and putting a formula in the control object but it doesn't work. The formula is ['Lowest_level'](name of the attribute)= IF((ISLEAF=1),1,STET);
Once I can calculate this attribute then maybe I can somehow add it up or something, but this formula is also not populating anything.
Any thoughts on this will be much appreciated.
Re: Count of Leaf
Posted: Sat Aug 14, 2010 7:14 am
by Alan Kirk
tryinghard wrote:
I have a dimension with multiple levels (5) in it, I would like to count the number of leaf levels in the dimension. I cannot use ELCOMPN because it gives the count of the children and not leafs (i.e. child of child) in other words great grand child count etc.
I tried creating an attribute and putting a formula in the control object but it doesn't work. The formula is ['Lowest_level'](name of the attribute)= IF((ISLEAF=1),1,STET);
Once I can calculate this attribute then maybe I can somehow add it up or something, but this formula is also not populating anything.
Any thoughts on this will be much appreciated.
My first thought is "why do you need to do this"? (Or more precisely, what is the exact objective that you are trying to reach? Hopefully something more than "I just want to know how many leaf elements it has".)
My second thought is that unless it's something very obscure, there are probably better ways of achieving it.
Re: Count of Leaf
Posted: Sat Aug 14, 2010 3:02 pm
by tryinghard
Alan,
I have 3 cube A, B & C.
It is for a calculation in C in which I am trying to divide a value in cube A equally in a hierarchy of cube B (which is also in C).
Detals:
The overall objecttive is allocation, In Cube A I have values, in Cube B I have allocation profile and Cube C has final values. Product Hierarchy dimension is not in A but in B & C, I am trying to allocate Values in A to products using a profile in B; however if there is no profile in B then I want that Value in A to distribute equally in the product hierarchy. This is the reason I need to know the leaf level count of the product hierarchy and I would like to keep it dynamic in case products are added or deleted.
I do not want to use TI because users want to see the affect of allocation immediately.
I also am struggling through the feeder also since Cube A does not have Product dimension, so not sure how to feed that.
Re: Count of Leaf
Posted: Mon Aug 16, 2010 11:00 am
by mce
I also realized that rules on numeric attributes on control cubes does not work.
Does anyone know why?
Re: Count of Leaf
Posted: Mon Aug 16, 2010 11:34 am
by lotsaram
mce wrote:I also realized that rules on numeric attributes on control cubes does not work.
Does anyone know why?
Numeric attributes are not really the same as numeric elements. They are actually just numeric formatted strings or strings in disguise. This is the reason you can directly enter a numeric attribute against a consolidated element, and also probably the reason why N: rules do not work in attribute cubes.
If you want to have a true numeric attribute that consolidates leaf values and/or can have a numeric leaf rule applied then you need to "roll your own" attribute cube (that is create a 2D lookup cube). You can then rule the values from the 2D lookup cube across to the attribute cube if you want to access the values as attributes.
Re: Count of Leaf
Posted: Mon Aug 16, 2010 12:22 pm
by tryinghard
lotsaram wrote:mce wrote:I also realized that rules on numeric attributes on control cubes does not work.
Does anyone know why?
If you want to have a true numeric attribute that consolidates leaf values and/or can have a numeric leaf rule applied then you need to "roll your own" attribute cube (that is create a 2D lookup cube). You can then rule the values from the 2D lookup cube across to the attribute cube if you want to access the values as attributes.
Thanks for the advice, I also did the same thing eventually... but good to know that formulas do not work on numric attributes.
Re: Count of Leaf
Posted: Tue Aug 17, 2010 6:36 am
by Andy Key
Rules
do work on numeric attributes in }ElementAttribute cubes, you just have to pretend that they are strings.
E.g.
Code: Select all
['Some Attribute Defined as Numeric'] = S: If( <Some condition>, '1', '0');
As noted previously, they are strings, so won't consolidate, and are probably best suited for flag type data.
Re: Count of Leaf
Posted: Tue Aug 17, 2010 7:17 am
by brewski
I needed to count the number of elements under a heirarchy and achieved the same thing using a separate cube in my local environment.
Create a new TI that creates a new cube using the Tm1 subset - set to your dimension. Choose another dimension to use like "units". The TI reads the dimension and enters a 1 against the element within the data. This runs on the chore that updates the dimension to ensure it is always up-to-date.
You could probably then link this in as another feeder.