Page 1 of 1

Using Attribute instead of repeating rule

Posted: Fri Nov 11, 2011 9:31 am
by ADW
I have this rule --> [{'Direct','Indirect','Staff'}, '2011'] = ['2011 AP 12'] ;

Quite simply it says that the consolidation YEAR for Direct, Indirect, and Staff should equal the child 2011 AP 12. The rule works fine, therefore the number shown in the 2011 consolidation is the same as the number in AP12 2011.

I don't want to write this rule again for each year in my time dimension and thought I could use an attribute to get around this. Can anyone let me know if a) this is possible, and, b) what the code may look like?

Thanks

Re: Using Attribute instead of repeating rule

Posted: Fri Nov 11, 2011 11:56 am
by Christopher Kernahan
Assuming '2011 AP 12 is' an element in the dimension 'Year' (rather than 'Version'), try;

[ 'Direct' ] =
DB( 'SameCubeName', !StaffType, ATTRS( 'Year', !Year, 'Planning Year' ), !Other Dim, !OtherDim );

[ 'Indirect' ] = etc.

Then as a text attribute ( 'Planning Year' ) on the dimension 'Year';
2011 -> 2011 AP 12
2010 -> 2010 AP 11
etc.

EDIT:
Haven't tested the below but maybe shows the idea.

[ { 'Direct', 'Indirect', 'Staff' } ] =
DB( 'SameCubeName', !StaffType,
!Year | ' AP ' | STR( NUMBR( SUBST( !Year, 3, 2)) + 1, 2, 0),
!Other Dim, !OtherDim );