Attribute Rules Explanation for Version?

Post Reply
jimicron
Posts: 110
Joined: Tue Oct 30, 2012 5:21 pm
OLAP Product: TM1
Version: 10.1.1
Excel Version: 2007 SP2 MSO
Location: Boise, ID

Attribute Rules Explanation for Version?

Post by jimicron »

Hey guys

I was taking up someone's suggestion in another thread of mine on just looking through rules in a sample library provided by IBM and trying to understand them and kinda got stuck :( I tried to draw it out (I am very visual if you haven't gathered that yet) :shock: and then peice together what this rule is doing in an attribute cube...

The rule is:

Code: Select all

['Forecast','FcstMonth']=S:ATTRS('MonthMap',STR(DB('Relative Time',DB('Calendar','Current Year','String'),'Year','ActForMonth'),2,0),'Name');
And below is the visual so you can literally see each cube / dimension it's referring to from this sample library. I think I need to do something similar in a Months attribute cube I have built is why I am looking at this specifically. I was hoping someone could put in layperson's terms what this rule is doing?

Thanks so much!
Attachments
Rules Example.jpg
Rules Example.jpg (188.75 KiB) Viewed 4059 times
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Attribute Rules Explanation for Version?

Post by declanr »

Just expand it from the inside out e.g.

Code: Select all

DB('Calendar','Current Year','String')
= 'Y2'

Then:

Code: Select all

DB('Relative Time', 'Y2' ,'Year','ActForMonth')
= 4

(I am assuming that there is an element in the months dim called "Year" which is a total of the months, 4 of them that I can see have 1's in) Although where you have "2012" selected is there also a "Y2" option or is "2012" an alias of "Y2"?

Then:

Code: Select all

STR(4,2,0)
= '4' (string instead of numeric)

Then:

Code: Select all

ATTRS('MonthMap','4','Name');
= 'Apr'


Obviously that required a bit of assumption on my behalf in the middle that might be wrong but even if it is you could follow the same logic, applying what you know to be correct and get an outcome accordingly.
Declan Rodger
jimicron
Posts: 110
Joined: Tue Oct 30, 2012 5:21 pm
OLAP Product: TM1
Version: 10.1.1
Excel Version: 2007 SP2 MSO
Location: Boise, ID

Re: Attribute Rules Explanation for Version?

Post by jimicron »

Thanks a lot Declanr!! Yes, your assumptions are correct!!

I guess time and experience will help to make it easier :) Now I need to reverse engineer (in a way) to accomplish what I am trying to do...

Which is look at a "string cube" (some IBM documentation called it this - where I have only one cell in the cube and the end user will but the date of the current month, ie 'Jun-13', and then I will pull that over to my 'Months' dimension as an attribute in my "current month" column (attribute) and call it "Current".... then, I want to drive a lot of rules off of that current... as in, for my "Actual or Forecast" column (attribute), if the "Current month" column... look for "Current" and put "Actual" and then "Actual" for all the months prior to that... and then "Forecast" for all the months beyond that... and then a bunch of other columns (attributes) - trying to automate everything and make a "master" dimension for others to use when they then develop on their own servers.

I'm using the idea that someone gave in my other thread about taking year, then concatenating it with a number to get an order... since my dimension has Years, Months, and then Mon-Yr in it.

Slowly but surely.

I appreciate the explanation because I can hopefully peice together what I want to do next. Thanks again!!

Oh - and here are screenshots of the dimension so you can see the alias on and off :)
Attachments
Year Dimension.jpg
Year Dimension.jpg (91.29 KiB) Viewed 4048 times
jimicron
Posts: 110
Joined: Tue Oct 30, 2012 5:21 pm
OLAP Product: TM1
Version: 10.1.1
Excel Version: 2007 SP2 MSO
Location: Boise, ID

Re: Attribute Rules Explanation for Version?

Post by jimicron »

This is why I was looking at the rules in other cubes in the sample server provided by IBM.

Here is my real life example. Where I seem to not have grasped yet is how to match something in one cube to something in another cube. I have an extremely strong back ground of Cognos Analyst and I am still trying to cross that mindset into TM1 with rules, etc. Thus, why i am struggling yet. Once I grasp a concept, then I tend to run with it. I am still trying to grasp at this point, which is frustrating (and requires patience)... I know conceptually of what I want... which is what I describe in the screenshot... but getting there is where I am struggling. :oops:

Thanks for any help anyone can provide at helping me understand how to accomplish this... or the mindset of how to think through it logically in order to write the rule to accomplish it. My hope is that I will eventually grasp, run with it, then be able to help others at some point versus just always being the one asking for help. :oops:
Attachments
Current Month Example.jpg
Current Month Example.jpg (160.69 KiB) Viewed 4046 times
jimicron
Posts: 110
Joined: Tue Oct 30, 2012 5:21 pm
OLAP Product: TM1
Version: 10.1.1
Excel Version: 2007 SP2 MSO
Location: Boise, ID

Re: Attribute Rules Explanation for Version?

Post by jimicron »

I THINK I am on the right path :) Not quite there yet... The code is working, but not exactly 100% accurately. What it's doing is putting "Current" in EVERY cell in the "Current Month" column.

Code: Select all

['Current Month'] = S:
		 IF(DB('Current Month', 'Current' , 'Month') @= DIMNM('Months',DIMIX('Months', DB('Current Month', 'Current' , 'Month'))) ,
		 'Current' ,
		 '');
Where, I only want it to say "Current" on the month that is listed in the "Current Month" cube, which is currently "Jun-13"
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Attribute Rules Explanation for Version?

Post by declanr »

jimicron wrote:I THINK I am on the right path :) Not quite there yet... The code is working, but not exactly 100% accurately. What it's doing is putting "Current" in EVERY cell in the "Current Month" column.

Code: Select all

['Current Month'] = S:
		 IF(DB('Current Month', 'Current' , 'Month') @= DIMNM('Months',DIMIX('Months', DB('Current Month', 'Current' , 'Month'))) ,
		 'Current' ,
		 '');
Where, I only want it to say "Current" on the month that is listed in the "Current Month" cube, which is currently "Jun-13"

You haven't included anything that will cause the formula to vary based on what cell intersection within the cube you are looking at (e.g. a ! ref)

What you are saying in your rule is:

Working on the right hand side of the "@="

Code: Select all

DB('Current Month', 'Current' , 'Month')
= 'Jun-13' (it will always be Jun-13 regardless of what position in the cube you are at)

Code: Select all

DIMIX('Months', 'Jun-13')
= 6 (probably not actually 6 but that's irrelevant, it will be the dimension position of the element Jun-13)

Code: Select all

DIMNM('Months',6)
= 'Jun-13' (this just converts your dimension index back to an element name, so the last 2 steps combined will do nothing other than add some memory overhead)

So with the last 2 steps cancelling each other out, you may as well have just had

Code: Select all

DB('Current Month', 'Current' , 'Month')
= 'Jun-13'

Then you take that result and compare it to the left hand side:

Code: Select all

DB('Current Month', 'Current' , 'Month')
= 'Jun-13' (which is exactly the same as your right hand side)



So your left hand side is the same as the right hand, you may as well be saying IF 1 = 1 DO SOMETHING..... 1 will always equal 1


Perhaps try something along the lines of:

Code: Select all

If ( !Months @= DB('Current Month', 'Current' , 'Month'), 'Current Month', '' ); 

Think of it in a similar way to when you were first introduced to simultaneous equations in school and you can keep cancelling parts of the equations out until you get down to the core components.
Declan Rodger
jimicron
Posts: 110
Joined: Tue Oct 30, 2012 5:21 pm
OLAP Product: TM1
Version: 10.1.1
Excel Version: 2007 SP2 MSO
Location: Boise, ID

Re: Attribute Rules Explanation for Version?

Post by jimicron »

Declanr - Seriously, thank you very much for your help (and explanation)!!! Extremely helpful and it got me over my hurdle. I can now apply the same sort of logic to about 15 other columns in my attribute cube. By explaining it, what I was doing was over complicating it and then in the end, it wasn't right (which I knew by the behaviour of the results). Thanks a lot though!! I really appreciate it!
Post Reply