Feed a rule based on attributes

Post Reply
jcortes
Posts: 10
Joined: Fri Sep 02, 2011 2:14 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007

Feed a rule based on attributes

Post by jcortes »

Hi, i am new in TM1, and i would like any help for feed this rule:

['Presupuesto'] = N: IF(ATTRS('Dim_Tiempo',!Dim_Tiempo,'FinMes(Y/N)')@='Y',STET,
DB('Cb_Cartera', !Dim_CuentasBalance, !Dim_Entidad, !Dim_Moneda, !Dim_MedidasCartera, !Dim_BCorporativoResto,
ATTRS('Dim_Tiempo',!Dim_Tiempo,'FinMes'), !Dim_Conversion, !Dim_Versiones));

I need to evaluate if the time dimension is in the last day of each month, if this is it then "STET", if dont, then copy the data for this last day in all other days into dimension. Tanks for your help or recommendations.

AMIN NOTE : Moved from bugs forum, please make sure you read forum guidelines and post in the correct forums, ta
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: Feed a rule based on attributes

Post by David Usherwood »

It looks as if you want to feed from the last day of each month to all the other days. That's a Big feeder. If this is really what you want to do, you'll probably need to write a set of explicit feeders, one for each month. I am assuming (and, for your sake, hoping :) ) that you have two time dimensions. If you don't, I think you'll need to go the TI route. Or 'discuss' the requirement with the users to get them to rethink.
User avatar
qml
MVP
Posts: 1096
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Feed a rule based on attributes

Post by qml »

Looks like you have a single time dimension. Depending on how your elements in the dimension look like, the feeder statement I'm proposing below can need a couple of changes, but the main idea should work. Unfortunately, it's a conditional feeder, but that shouldn't be too big of an issue in your case (assuming stable dimension structure). You do not necessarily need to write explicit feeders, but all David's assertions still hold and I would try and avoid such feeding as it has the potential to be big.

I am assuming in the below code that the N element format is: YYYY-MMM-DD (e.g. 2011-Sep-29) and that your month consolidations have the format of YYYY-MMM (e.g. 2011-Sep).

Code: Select all

FEEDERS;
['Presupuesto'] => IF (ATTRS('Dim_Tiempo',!Dim_Tiempo,'FinMes(Y/N)')@='Y',
DB('Cb_Cartera', !Dim_CuentasBalance, !Dim_Entidad, !Dim_Moneda, !Dim_MedidasCartera, !Dim_BCorporativoResto, SUBST(!Dim_Tiempo,1,8), !Dim_Conversion, !Dim_Versiones),
);
Kamil Arendt
User avatar
paulsimon
MVP
Posts: 808
Joined: Sat Sep 03, 2011 11:10 pm
OLAP Product: TM1
Version: PA 2.0.5
Excel Version: 2016
Contact:

Re: Feed a rule based on attributes

Post by paulsimon »

jcortes wrote: ['Presupuesto'] = N: IF(ATTRS('Dim_Tiempo',!Dim_Tiempo,'FinMes(Y/N)')@='Y',STET,
DB('Cb_Cartera', !Dim_CuentasBalance, !Dim_Entidad, !Dim_Moneda, !Dim_MedidasCartera, !Dim_BCorporativoResto,
ATTRS('Dim_Tiempo',!Dim_Tiempo,'FinMes'), !Dim_Conversion, !Dim_Versiones));
Hola

qml - I think your IF would need to be within the DB in a feeder

Presupuesto in English means Budget, so I am guessing that you are copying the budget from month end to all dates in the month. Am I right in assuming that Presupuesto is an element in Dim_Versiones?

(By the way it seems odd that you have version as the last dimension in your cube - the usual recommendation is to have the measures dimension last.)

Does your time dimension Dim_Tiempo have consolidations from Days (Dias) to Months (Meses)?

If so then your feeder would be something like this:

['Presupuesto'] =>
DB('Cb_Cartera', !Dim_CuentasBalance, !Dim_Entidad, !Dim_Moneda, !Dim_MedidasCartera,
!Dim_BCorporativoResto,
subst function to convert from Dia to Mese !Dim_Tiempo,
!Dim_Conversion, !Dim_Versiones);
For
subst function to convert from Dia to Mese !Dim_Tiempo,
eg
If your dates are in the form 2011-09-01 and your month consolidation are in the form 2011-09 then you just
need subst(!Dim_Tiempo,1,7)

Feeding a consolidation automatically feeds all elements below it, so feeding the month consolidation will feed the dates in that month.

Granted there is a slight inefficiency in that you will find the month end date which has a value, but that is relatively minor.

However, I would consider whether you really need to do this. On average you will be increasing the size of the cube by a factor of around 30. That is likely to make things somewhat slower.

Other alternatives might be:

Create a Dim_Mese dimension. Create another similar cube Cb_Presupuesto, but with Dim_Mese in place of Dim_Tiempo, ie a month level dimension. Hold the Budget in this Cube.

Pull the total of the Actuals from the Day level cube over to the Cb_Presupuesto Cube and compare Actual to Presupuesto there.

Just calculate the Variance in the Day level cube, and use a rule to reference the Budget in the Month level cube.

Regards

Paul Simon
User avatar
qml
MVP
Posts: 1096
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Feed a rule based on attributes

Post by qml »

paulsimon wrote:qml - I think your IF would need to be within the DB in a feeder
:oops: It wasn't me, my friend has used my forum id for this. ;) :lol:

Corrected feeder statement:

Code: Select all

FEEDERS;
['Presupuesto'] => DB( 
IF (ATTRS('Dim_Tiempo',!Dim_Tiempo,'FinMes(Y/N)'@='Y', 'Cb_Cartera', ''),
!Dim_CuentasBalance, !Dim_Entidad, !Dim_Moneda, !Dim_MedidasCartera, !Dim_BCorporativoResto, SUBST(!Dim_Tiempo,1,8), !Dim_Conversion, !Dim_Versiones);
Kamil Arendt
jcortes
Posts: 10
Joined: Fri Sep 02, 2011 2:14 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007

Re: Feed a rule based on attributes

Post by jcortes »

Thanks a lot for everyone. let me explain, the user needs to copy the budget (Presupuesto) for day Jan-31-2011 in all other days from Jan-01-2011 to Jan-30-2011, the same for each month, i agree the best will be use TI.

But i run into a similar issue feeding some similar rules wich include atributes, the feeder does not work.

['Saldo','Presupuesto'] = N: IF(ATTRS('Dim_CuentasBalance', !Dim_CuentasBalance, 'Cartera(Y/N)')@='YVI',
(1-DB('Cb_Cartera', ATTRS('Dim_CuentasBalance',!Dim_CuentasBalance, 'Cartera'), !Dim_Entidad,
!Dim_Moneda, '% de Mora', !Dim_BCorporativoResto, !Dim_Tiempo, !Dim_Conversion, !Dim_Versiones))*

DB('Cb_Cartera',ATTRS('Dim_CuentasBalance',!Dim_CuentasBalance, 'Cartera'), !Dim_Entidad, !Dim_Moneda, 'Saldo',
!Dim_BCorporativoResto, !Dim_Tiempo, !Dim_Conversion, !Dim_Versiones) ,CONTINUE);


I apreciate your help your a great team of proffesionals.
User avatar
qml
MVP
Posts: 1096
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Feed a rule based on attributes

Post by qml »

jcortes wrote:But i run into a similar issue feeding some similar rules wich include atributes, the feeder does not work.
Can you provide this feeder statement here?
Kamil Arendt
jcortes
Posts: 10
Joined: Fri Sep 02, 2011 2:14 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007

Re: Feed a rule based on attributes

Post by jcortes »

I really do not know, something like:

['% de Mora'] => ['Presupuesto'];
['% de Mora'] => ['Saldo'];
['Saldo'] => ['Presupuesto'];

And back to the first issue, i need to do something in turbo integrator to deal to:

The time dimension is a continous dimension: 2011-10-01, 2011-10-02 ... 2011-10-31, the budget is writen into the last day of every month (2011-10-31) and the user wants to copy this same figure into every day of the correspondant month, is this possible in TI?, how can I do that? thanks again for your help.
User avatar
qml
MVP
Posts: 1096
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Feed a rule based on attributes

Post by qml »

jcortes wrote:I really do not know, something like:

['% de Mora'] => ['Presupuesto'];
['% de Mora'] => ['Saldo'];
['Saldo'] => ['Presupuesto'];
What do you mean you don't know? How do you want to fix any feeders if you don't know what they are currently?

The feeder statements above will not work as they are feeding from one measure to another for the same values of all dimensions, including Dim_CuentasBalance, but in this dimension you want to feed based on the Cartera attribute. The feeders above are not doing this in any way.
jcortes wrote:The time dimension is a continous dimension: 2011-10-01, 2011-10-02 ... 2011-10-31, the budget is writen into the last day of every month (2011-10-31) and the user wants to copy this same figure into every day of the correspondant month, is this possible in TI?, how can I do that? thanks again for your help.
Yes, it's possible and even not so difficult (just think what your data source would be and go from there), but I'm not sure whether you want to go down that road, multiplying your data volume and memory usage by a factor of 30. Rules with feeders would be more memory-effective, if you really have to have these values copied across. But maybe you don't? What benefit does it give to store redundant data? Go back to your requirements and think about them.
Kamil Arendt
jcortes
Posts: 10
Joined: Fri Sep 02, 2011 2:14 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007

Re: Feed a rule based on attributes

Post by jcortes »

Thanks a lot for your cooperation i will put into accion your advices.
Post Reply