Page 1 of 1

Identify N Level Elements by parent attribute value

Posted: Fri Nov 26, 2010 8:09 pm
by vinnusea
Hi
I have a senario where Users enters attribute value 1 if they need that particular family to bring its N level values to Other Measure.

I have attached picture where it can be understand easyly Picture "Cube1" & "Dim1"

If "L Series 4WD" attribute value is set to 1 then Pull its N Level "Units "--> To --> "New Measure" and so on for all families whos attr value is set to 1.

And the Final Top level must be the aggregation of all Its Lower levels Total....

Please guide me a approach to achieving it..

Thanks..

Re: Identify N Level Elements by parent attribute value

Posted: Sun Nov 28, 2010 8:32 pm
by Martin Ryan
Not 100% sure I understand the problem, but I think this might do the trick for you

Code: Select all

['New Measure'] = N:
if(attrn('Model', elpar('Model', !Model, 1), 'TheAttr')=1, ['Units'], 0);
# If the attribute might be two levels up then this might be necessary instead...
['New Measure'] = N:
if(attrn('Model', elpar('Model', !Model, 1), 'TheAttr')=1 %
attrn('Model', elpar('Model', elpar('Model', !Model, 1), 1), 'TheAttr')=1
, ['Units'], 0);
You won't need to do anything special at the aggregation level.

HTH,
Martin

Re: Identify N Level Elements by parent attribute value

Posted: Wed Dec 01, 2010 3:08 pm
by vinnusea
Hi
Your logic is working for me as i tried in Model Dim its good but when am trying to write same logic to my dimension (Pic Attached) is not working ... can you please have a look in that Pic and tell me how many levels do i need to use..

Here "Scrap value" is the attribute am using when it is 1 i need to pull values from "sales Revenue"
attribute value is given 1 at '3 rd level' for "Vitoss"
My Rule is
['Testing_Measure'] = N:
if(
Attrn('OV_Item', !OV_Item, 'Scrap_Value')=1 %

Attrn('OV_Item', elpar('OV_Item',elpar('OV_Item',!OV_Item, 1), 1), 'Scrap_Value')=1 %
Attrn('OV_Item', elpar('OV_Item',elpar('OV_Item',elpar('OV_Item',!OV_Item, 1), 1), 1), 'Scrap_Value')=1


, ['Sales Revenue'], stet);

Re: Identify N Level Elements by parent attribute value

Posted: Wed Dec 01, 2010 4:32 pm
by ajain86
I believe you need 1 more:

[code['Testing_Measure'] = N: if(
Attrn('OV_Item', !OV_Item, 'Scrap_Value')=1 %
Attrn('OV_Item', elpar('OV_Item',elpar('OV_Item',!OV_Item, 1), 1), 'Scrap_Value')=1 %
Attrn('OV_Item', elpar('OV_Item',elpar('OV_Item',elpar('OV_Item',!OV_Item, 1), 1), 1), 'Scrap_Value')=1 %
Attrn('OV_Item', elpar('OV_Item',elpar('OV_Item',elpar('OV_Item',elpar('OV_Item',!OV_Item, 1), 1), 1), 1), 'Scrap_Value')=1
, ['Sales Revenue'], stet);
][/code]