Page 1 of 1

TM1 Rules Scenario Using Attributes

Posted: Mon Feb 29, 2016 12:24 pm
by wigglyrat
Hi - I have a requirement to rebuild a cube 'Commercial' with one additional dimension.

This cube 'Commercial' is currently using rules with DB functions to pull data into it from another cube 'zz Accident Year'.

In the 'Commercial' cube, one dimension ('zz BDE') held virtually identical data (just structured in a different hierarchy) to the ''zz Broker' dimension in the 'zz Accident Year' cube, so I used attributes to look up and match 'Agency no' between the two, as the example below shows, as agency numbers were the same between both.

Code: Select all

['zz Underwriting Year':'Unanalysed','Net Earned Premium','zz Tenure':'Unspecified']=N:DB('zz Accident Year','Actual',!zz Heads of Damage,!zz Accident Period,!zz Class,attrs('zz BDE',!zz BDE,'Agency No'),!zz Policy Event Type,'All Cover Types',!zz Development Month,!zz Measures);
Now the requirement is to add that dimension to the 'Commercial' cube which also exists in 'zz Accident Year', 'zz Broker'

This would ordinarily I suppose negate the need for using attributes to look up the data between 'zz BDE' dimension and 'zz Broker' dimension. But, I need to keep the 'zz BDE' dimension in the 'Commercial' cube as well, so I still need to use this attribute, I think.

How do I then tell TM1 that I want 'zz Broker' in the 'Commercial' cube to equal 'zz Broker' in the 'zz Accident Year' cube in the rule above while also keeping the attribute lookup?

Many thanks in advance for your advice.

Re: TM1 Rules Scenario Using Attributes

Posted: Mon Feb 29, 2016 1:35 pm
by tomok
You really should provide the complete dimensionality of all the cubes involved. Trying to discern what you are trying to do, based on your disjointed post, made my head hurt.

Re: TM1 Rules Scenario Using Attributes

Posted: Mon Feb 29, 2016 2:18 pm
by wigglyrat
Apoligies.

The cube dimensions are as follows:

Commercial:
zz BDE (this uses attributes to look up agency no elements in zz Broker dimension below)
zz Broker (this is the new dimension that I need to adjust the rule to bring in)
zz Class
zz Development Month
zz Underwriting Year
zz Accident Period
zz Policy Event Type
zz Version
zz Heads of Damage
zz Tenure
zz Measures

zz Accident Year
zz Version
zz Heads of Damage
zz Accident Period
zz Class
zz Broker
zz Policy Event Type
zz Cover
zz Development Month
zz Measures


Many thanks again.

Re: TM1 Rules Scenario Using Attributes

Posted: Mon Feb 29, 2016 2:25 pm
by declanr
If I follow correctly then something like below should point you in the right direction.

Code: Select all

['zz Underwriting Year':'Unanalysed','Net Earned Premium','zz Tenure':'Unspecified']=N:
If ( attrs('zz BDE',!zz BDE,'Agency No') @= !zz Broker,
	 DB('zz Accident Year','Actual',!zz Heads of Damage,!zz Accident Period,!zz Class, !zz Broker,!zz Policy Event Type,'All Cover Types',
	 !zz Development Month,!zz Measures),
	 0
);

Re: TM1 Rules Scenario Using Attributes

Posted: Mon Feb 29, 2016 3:53 pm
by wigglyrat
Hi and thank you for the code.

I am not sure if I follow this.

The code above produces "Syntax error on or before: !zz Broker, DB(' incorrect logical comparison"

error.

Also I am not sure about using a conditional formula for this?

I would like it to pull data across to both "zz Broker" (using !zz Broker as this dimension exists in both) and "zz BDE" (using the attribute look-ups as it does now in the old rule), so doing both.

The users want to use both dimensions even though they are nearly the same.

Sorry if I am being confusing and thank you again for your help.

Re: TM1 Rules Scenario Using Attributes

Posted: Mon Feb 29, 2016 5:58 pm
by declanr
wigglyrat wrote: Also I am not sure about using a conditional formula for this?

I would like it to pull data across to both "zz Broker" (using !zz Broker as this dimension exists in both) and "zz BDE" (using the attribute look-ups as it does now in the old rule), so doing both.
That is what the if statement does. The rule without it would pull the value in to the correct zz broker element for EVERY element in your other dimension.
With the if statement it will only try and populate the intersection where the element in your other dimension has an attribute that matchs the zz broker element.

As to the syntax error it can be difficult to tell only with the code on the forum but to start with the basics did you put the code exactly as shown or did you replace @= with just an = symbol?

Also syntax could suggest I have missed a comma or bracket etc somewhere; it should be easy for you to check that stuff though.

Re: TM1 Rules Scenario Using Attributes

Posted: Tue Mar 01, 2016 9:05 am
by babytiger
If all leaf elements in 'zz BDE' and 'zz Broker' are identical (as you've suggested), you can substitute declanr's rule with:

Code: Select all

['zz Underwriting Year':'Unanalysed','Net Earned Premium','zz Tenure':'Unspecified']=N:
IF ( !zz BDE@=!zz Broker,
    DB('zz Accident Year','Actual',!zz Heads of Damage,!zz Accident Period,!zz Class, !zz Broker,!zz Policy Event Type,'All Cover Types',
    !zz Development Month,!zz Measures),
    0
);

Re: TM1 Rules Scenario Using Attributes

Posted: Thu Mar 03, 2016 4:34 pm
by wigglyrat
It became evident that it was far simpler to do this via a TI instead of the rule so this is now working. Thanks to everyone for the assistance. :D