C Level Rules with attributes evaluations in N level elements

Post Reply
jjramirez
Posts: 22
Joined: Fri Jan 13, 2017 12:33 pm
OLAP Product: Cognos TM1
Version: 10.2.2
Excel Version: Excel 2013

C Level Rules with attributes evaluations in N level elements

Post by jjramirez » Wed Jun 06, 2018 9:48 pm

Hello everybody!

I have a conceptual doubt with TM1 Rule Calculation for C Level elements. I need the rules to aply only for specific C level elements in time dimension (month) but All attributes that i have to evaluate are defined for a N level element (!Concesion). I Know C level Rules only apply for C level elements but i was expecting that making sure one element (month in this case) is C level the rule will work fine but as a result i have some attributes evaluations ignored.
In the following rule only ATTRN evaluation for periodicity is working good, the others are ignored:
[ 'Capital', 'Real' ] =C:

IF (
# With the following 3 lines i am trying to ensure the element for time dimension correspond to the C level element that i need:
( DType ( 'Month', !Month ) @= 'C' )
& ( ElIsAnc ( 'Month', 'QTD', !Month ) = 1)
& ( Ellev ( 'Month', !Month ) = 1)

# With the folowing 4 lines i am evaluating the attributes values that have sense for the rule where " !Concesion " is a N Level element:
& ( AttrS ('Concesion' , !Concesion , 'Moneda Base Contrato' ) @= !Moneda )
& ( AttrS ('Concesion' , !Concesion , 'Terminal' ) @= !Terminal )
& ( AttrS ('Concesion' , !Concesion , 'Tipo Concesion' ) @= 'Municipio' )
& ( AttrN ('Concesion' , !Concesion , 'Periodicity' ) = 3 )

# calculations:
, AttrN ('Concesion' , !Concesion , 'Value' )
- DB( 'C.Concesion',!Terminal,!Concesion ,!Version , !Month , !Moneda ,'Interest')
, Continue
) ;
It has any sense with my logic or is completely wrong according to the concept?
If it is wrong, may you please suggest something else?


many thanks!

MGrain
Posts: 11
Joined: Wed Nov 15, 2017 11:36 am
OLAP Product: TM1
Version: Various
Excel Version: Various

Re: C Level Rules with attributes evaluations in N level elements

Post by MGrain » Thu Jun 07, 2018 8:24 am

If you want the rule to apply at the C level on the time dimension but N level on other dimensions you can't use =C: in the rule, that limits the rule to C level elements across all dimensions.

As you are already using an if test to limit Month to the C level elements you want, try simply removing the C: so the rule operates at both C and N levels.

Code: Select all

[ 'Capital', 'Real' ] =

IF ( 
# With the following 3 lines i am trying to ensure the element for time dimension correspond to the C level element that i need:
( DType ( 'Month', !Month ) 

lotsaram
MVP
Posts: 3092
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TM1, CX
Version: TM1 10.2.2 PA 2.0x
Excel Version: 2010 2013 365
Location: Switzerland

Re: C Level Rules with attributes evaluations in N level elements

Post by lotsaram » Thu Jun 07, 2018 12:00 pm

MGrain wrote:
Thu Jun 07, 2018 8:24 am
If you want the rule to apply at the C level on the time dimension but N level on other dimensions you can't use =C: in the rule, that limits the rule to C level elements across all dimensions.
No, no. no, no and NO!

The N:, C: & S: filters in rule statements apply to cube cells. To be consolidated a cell must be consolidated on one or more dimensions and not all dimensions. A rule with a C: filter will apply to cells where all dimensions are leaf except for one. That's all it takes.

Apologies to the OP. This doesn't answer your question, but if you're starting out best to collect as few wrong ideas as possible.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.

MGrain
Posts: 11
Joined: Wed Nov 15, 2017 11:36 am
OLAP Product: TM1
Version: Various
Excel Version: Various

Re: C Level Rules with attributes evaluations in N level elements

Post by MGrain » Thu Jun 07, 2018 4:08 pm

I think we may be talking at cross purposes here. I guess I didn't express myself very clearly (it was early, before coffee).

The point I was trying to make was:

If you use C: your rule will apply to all C level elements in all dimensions thus preventing natural consolidation. If the OP only wants to limit the Time dimension and has done so with an if test, the C: is probably unnecessary.

All that aside, looking at it further, if the ATTRN is evaluating but the ATTRSs aren't, the whole C: thing is probably a red herring.

Presumably you've used the rules tracer to determine that it is the ATTRS that's failing? You could try replacing them with a standard DB into the }ElementAttributes_Concesion cube.

User avatar
Steve Rowe
Site Admin
Posts: 1783
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: 10.2.2., PAW
Excel Version: Nearly all of them

Re: C Level Rules with attributes evaluations in N level elements

Post by Steve Rowe » Thu Jun 07, 2018 4:41 pm

[ 'Capital', 'Real' ] =C:

IF (
# With the following 3 lines i am trying to ensure the element for time dimension correspond to the C level element that i need:
( DType ( 'Month', !Month ) @= 'C' )
& ( ElIsAnc ( 'Month', 'QTD', !Month ) = 1)
& ( Ellev ( 'Month', !Month ) = 1)

# With the folowing 4 lines i am evaluating the attributes values that have sense for the rule where " !Concesion " is a N Level element:
& ( AttrS ('Concesion' , !Concesion , 'Moneda Base Contrato' ) @= !Moneda )
& ( AttrS ('Concesion' , !Concesion , 'Terminal' ) @= !Terminal )
& ( AttrS ('Concesion' , !Concesion , 'Tipo Concesion' ) @= 'Municipio' )
& ( AttrN ('Concesion' , !Concesion , 'Periodicity' ) = 3 )

# calculations:
, AttrN ('Concesion' , !Concesion , 'Value' )
- DB( 'C.Concesion',!Terminal,!Concesion ,!Version , !Month , !Moneda ,'Interest')
, Continue
) ;
I've seen cases where rules don't work quite right where you mix comparisons between strings and numeric in the same logic. Normally this triggers a compile error though.
I think that the DType (....)@='C' is redundant an element that is level must be C so no need to check for that. You've a lot of tests in there so I'd be looking to remove some.
This piece
AttrS ('Concesion' , !Concesion , 'Moneda Base Contrato' ) @= !Moneda )
& ( AttrS ('Concesion' , !Concesion , 'Terminal' ) @= !Terminal )
& ( AttrS ('Concesion' , !Concesion , 'Tipo Concesion' ) @= 'Municipio' )
I would do as
AttrS ('Concesion' , !Concesion , 'New Attr' ) @=!Moneda | !Terminal | 'Municipio'

With New Attr populated with a TI (don't put a string rule in the attr cube, as this would not be cached and you won't gain anything).

As to why your rule isn't working you probably have a basic issue with syntax or references rather than a mysterious TM1 bug, only you are going to be able to figure this out. You could post a screen shot of the rule trace, this may help.

Also check that you don't have a rule before this interfering with the behaviour..

(Hi Mike!)

jjramirez
Posts: 22
Joined: Fri Jan 13, 2017 12:33 pm
OLAP Product: Cognos TM1
Version: 10.2.2
Excel Version: Excel 2013

Re: C Level Rules with attributes evaluations in N level elements

Post by jjramirez » Thu Jun 14, 2018 2:59 pm

Hello!
Fisrt of all: Sorry for the late response, i was out of the office for a few days.
And Thnak you very much for you comments.

I am agree with MGrain, =C: is unnecessary as i am evaluating only C elements in time dimension
I've reviewed if there is another rule interfering, but i didn't see anything.
I replaced the Attr by DB's directed to the control cube
After all changes i'am still with the same situation... i think i will move to another option: create an auxiliary elements to calculate at N level the C level values and then call it from the original elements... i think it's not the best solution so if you have more ideas please let me know, i will be open to try.

Again, many thanks for your replies.

Post Reply