Page 1 of 1

TM1 Rule to Propagate Values Between Dimensions

Posted: Mon Mar 25, 2024 7:51 pm
by rrizwansayed10
Hello,

I'm seeking assistance with creating a TM1 rule to dynamically propagate values between dimensions in IBM TM1.

There are 2 dim Product & CPG, Half of Product dimension is in CPG.

For eg, Product dimension is,
'Total Company' parent of 'PC' and 'HC', 'PC' splits in 'CPG1' and 'CPG2', 'HC' splits in 'CPG3' and 'CPG4', and 'CPG1' splits in 'LE1' and 'LE2' and 'CPG2' splits in 'LE3' and 'LE4', 'CPG3' splits in 'LE5' and 'LE6', 'CPG4' splits in 'LE7' and 'LE8'.

For eg, CPG dimension is,
'Total Company' parent of 'PC' and 'HC', 'PC' splits in 'CPG1' and 'CPG2', 'HC' splits in 'CPG3' and 'CPG4'.

Objective:
My objective is to create a rule that automatically updates attributes in the Product dimension based on changes made at level 0 elements in the CPG dimension. Specifically, when a value ('Y') is entered at a level 0 element in the CPG dimension, I want this value to be propagated to specific leaf elements in the Product dimension that correspond to that CPG element.
For eg,
If you input 'Y' at the level 0 element 'CPG2' in the CPG dimension, you want this 'Y' value to be propagated to the leaf elements 'LE3' and 'LE4' in the Product dimension, which correspond to 'CPG2'.

Current Approach:
I've attempted to create a rule using the following logic:

['at_PBBU'] = S: If (DB('}ElementAttribute_CPG', !CPG, 'PPBU') @= 'Y', 'Y', ' ');

However, this rule doesn't seem to be achieving the desired outcome.

Request for Assistance:
I'm seeking guidance on how to create a rule that effectively achieves my objective. Additionally, if there's a better approach or alternative solution to accomplish this task, I'm open to suggestions.

Any help or insights would be greatly appreciated!

Thank you.

Re: TM1 Rule to Propagate Values Between Dimensions

Posted: Mon Mar 25, 2024 10:10 pm
by Wim Gielis
Do you really think people will still want to help, voluntarily, after your first post here ?
viewtopic.php?t=16641
Hijacking a thread, not responding to help given, etc.
Not for me :-)

Re: TM1 Rule to Propagate Values Between Dimensions

Posted: Tue Mar 26, 2024 7:39 am
by rrizwansayed10
Common man, thanks for your advice on the previous reply, :D :D
That really helped me alot. And I apologies for not replying @WimGielis. :) :)
Now lets discuss this Wim.

Re: TM1 Rule to Propagate Values Between Dimensions

Posted: Tue Mar 26, 2024 9:19 am
by MarenC
Hi,

On first reading this doesn't make sense to me,

I think you say you want to update the product attributes based on the CPG attributes but you appear to be putting the rule in the CPG attribute cube, not the product attribute cube?

I would have expected to see something like this:

['at_PBBU'] = S: If (DB('}ElementAttribute_CPG', !Product, 'PPBU') @= 'Y', 'Y', ' ');

Not that I expect the above code to be the right approach just that I expect the rule to be in the product attribute cube.

Obviously given there are more codes in product than in CPG you will need some way to map the product element to the CPG element.

So the code would be more like:

['at_PBBU'] = S: If (DB('}ElementAttribute_CPG', ATTRS('Product',!Product,'CPG Map Element') 'PPBU') @= 'Y', 'Y', ' ');

The above assumes you Map via a product attribute.

Maren

Re: TM1 Rule to Propagate Values Between Dimensions

Posted: Tue Mar 26, 2024 11:45 am
by rrizwansayed10
Hi MarenC,

Thank you so much for your reply, but I tried this, this isnt working.
And I am writing the rule in product attribute cube only.
2 rules I tried:-
1.) ['at_PBBU'] = S: If( (DB('}ElementAttribute_Cpg_hierarchy', ATTRS('Product', !Product ,'at_CPG'), 'att_PPBU') @= 'Y') , 'Y' , '' );

2.) ['at_PBBU'] = S: If( (DB('}ElementAttribute_Cpg_hierarchy', !Product , 'att_PPBU') @= 'Y') , 'Y' , '' );

But both this rule is not working.

Thanks...

Re: TM1 Rule to Propagate Values Between Dimensions

Posted: Tue Mar 26, 2024 5:07 pm
by MarenC
Hi,

I think we need more information, one bit of information that would be useful is what do you mean exactly by "But both this rule is not working."?

Also, if you provide a single example of a product that isn't working, i.e. provide its 'at_CPG' attribute value and also the 'att_PPBU' attribute value for this 'at_CPG' element.

Maren

Re: TM1 Rule to Propagate Values Between Dimensions

Posted: Wed Mar 27, 2024 8:27 am
by lotsaram
rrizwansayed10 wrote: Tue Mar 26, 2024 11:45 am Hi MarenC,

Thank you so much for your reply, but I tried this, this isnt working.
And I am writing the rule in product attribute cube only.
2 rules I tried:-
1.) ['at_PBBU'] = S: If( (DB('}ElementAttribute_Cpg_hierarchy', ATTRS('Product', !Product ,'at_CPG'), 'att_PPBU') @= 'Y') , 'Y' , '' );

2.) ['at_PBBU'] = S: If( (DB('}ElementAttribute_Cpg_hierarchy', !Product , 'att_PPBU') @= 'Y') , 'Y' , '' );

But both this rule is not working.

Thanks...
Assuming that the elements from the 'Product' dimension also exist in the 'Cpg_hierarchy' and the 'att_PPBU' and 'at_CPG' attributes exist then it is obvious that the rule isn't working because the cube '}ElementAttribute_Cpg_hierarchy' doesn't exist. It should be '}ElementAttributes_Cpg_hierarchy'.

Although it is true that DB to attribute cube is marginally faster than ATTRS, for readibility and simplicity I think it's better to use ATTRS. In this case you would have saved yourself from the typo.

Further suggestions:
- don't mix ATTRS and DB to attribute cube! Go with one or the other (especially in the same line of code)
- attribute naming 'att_PPBU' vs. 'at_CPG'! Is this another typo?
- the slowest thing to evaluate in a rule is a Boolean test (that is an IF). Why not eliminate the IF and just return the 'Y' from the function being evaluated? (and/or presumably the blank or 'N')

Re: TM1 Rule to Propagate Values Between Dimensions

Posted: Fri Apr 19, 2024 11:28 am
by rrizwansayed10
Thanks all for the reply,

['at_PBBU'] = S: If( (DB('}ElementAttribute_Cpg_hierarchy', ATTRS('Product', !Product ,'at_CPG'), 'att_PPBU') @= 'Y'),
DB('}ElementAttribute_Cpg_hierarchy', ATTRS('Product', !Product ,'at_CPG'), 'att_PPBU'),
' ' );

This rule is working now.

I wanted to put Y flag in the product hierarchy only if cpg hierarchy has Y flag.