Moving data between cubes using attributes

Post Reply
RachelB
Posts: 2
Joined: Wed Jul 22, 2009 3:36 pm
OLAP Product: TM1
Version: 9.0
Excel Version: 2007

Moving data between cubes using attributes

Post by RachelB »

(Transferred from another forum)
Original query:
Cube A's time dimension consists of month elements (eg. Jan_09, Feb_09, etc.) Cube B's time dimension is comprised of date elements (e.g. 2009-01-01, 2009-01-02, etc.) with monthly roll-ups (Jan_09, Feb_09, etc.). I have to move data from Cube A to Cube B. Since the time dimensions are different, I added a "LastDay" attribute to the month elements in Cube A. The attribute corresponds to a date element in Cube B. I tried this rule in Cube B:
['Unit Produced']=N:DB('Cube A','Total Sources','Actual',!Location,attrs('Period',!Period,'LastDay'),'Quantity Produced');
It returns an "invalid string expression" error message.

Solution:
Hi Rachel,

Yes this forum is very buggy! (there is an alternative non-IBM TM1 forum which higher participation and monitoring than this one, just google tm1 forum).

If I understand you correctly it looks like you have your logic with the flow of attributes round the wrong way for what you want to do. The way you have set things up would be useful to PULL data from the last day of month in cube B to the period in cube A, but not visa versa. Cube B contains the date dimension, as it does not contain the period dimension you cannot reference an attribute from the period dimension using !period as there is no handle to the dimension member.

You need to set the attribute up in the data dimension, actually I would suggest setting up 2 attributes; "Period" which can be set for all dates and "IsLastDayOfMonth" which contains a value only for the dates which are the last day of the month. Once these attributes are populated your rule would look something like this:
['Units Produced'] = N:
If( AttrS('Date', !Date, 'IsLastDayOfMonth') AT 'Y',
0,
DB('Cube A', 'Total Sources', 'Actual', !Location, AttrS('Date',!Date,'Period'), 'Quantity Produced')
);

The attribute that you already have in the period dimension will still be useful as you can use this to FEED units produced in cube B from quantity produced in cube B (assuming you don't have an appropriate internal feeder in cube B for units produced).

Additional question:
Thanks for your help. Can you elaborate on your final instruct regarding FEED? I'm assuming FEED statement will be in cube A rules, right? I will run it this morning and will let you know what I get but I think it is the solution I need.
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: Moving data between cubes using attributes

Post by David Usherwood »

Thanks for moving the query!
The feeder needs to be in cube B. Feeders only happen at N level, so you need to have a link between 2009-01-01, 2009-01-02 in B and Jan_09 in A. _If_ the time dimension in B has only one parent, you could potentially use elpar, but it isn't a very safe approach - if the structures change the link breaks, since TM1 doesn't control the order of parents.

A better approach is to define an attribute against the Cube B time dimension which delivers the link. Some of the stuff I found in the date formatting would probably work quite well - you'd need to write a TI since rules don't support it yet. Or maybe just update it manually?
http://forums.olapforums.com/viewtopic.php?f=3&t=480
RachelB
Posts: 2
Joined: Wed Jul 22, 2009 3:36 pm
OLAP Product: TM1
Version: 9.0
Excel Version: 2007

Re: Moving data between cubes using attributes

Post by RachelB »

Ok. Should I add this in the feeder section?
DB('Cube A', 'Total Sources', 'Actual', !Location, AttrS('Date',!Date,'Period'), 'Quantity Produced') => ['Units Produced']
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: Moving data between cubes using attributes

Post by David Usherwood »

Not quite. The LHS of a feeder (and a rule) must always be an area. So taking your code, something on the lines of
['Quantity Produced'] =>
DB('Cube A', 'Total Sources', 'Actual', !Location,
AttrS('Date',!Date,'Period'),
'Units Produced')
;
But then you need to populate the Period attribute of Date, manually, via rules or via TI. I prefer rules but I couldn't immediately spot how to do it with your coding structures.
Post Reply