Using Attribute instead of repeating rule

Post Reply
User avatar
ADW
Posts: 32
Joined: Tue Jun 14, 2011 11:10 am
OLAP Product: Cognos Express
Version: 9.5
Excel Version: 2010
Location: Cheshire, England

Using Attribute instead of repeating rule

Post 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
Christopher Kernahan
Community Contributor
Posts: 147
Joined: Mon Nov 29, 2010 6:30 pm
OLAP Product: Cognos TM1
Version: 10.1
Excel Version: Office 2010

Re: Using Attribute instead of repeating rule

Post 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 );
Post Reply