Page 1 of 1

Rules

Posted: Tue Aug 10, 2010 12:55 pm
by Santiago
Hi,
I want to write a rule that calculates the amount (price) of a product according to the previous period's price multiplied by the percentage increase in his current term.
I want that element Medidas_Precio Amount of dimension can only type in the value of the initial period. Also will be able to type in the values of the percentages. Therefore, I want to write the rule would give me the rest of the values of the following months.
I put this rule does not work: ['Importe']=N:DB('Precios',DIMNM('Periodos',(DIMIX('Periodos',!Periodos)-1)),!ProductsDimension,!Versiones,!Year,!Medidas_Precio)*['Porcentaje','Forecast'];
You can do the following but I do it only in a formula:
#['Importe','Jan']=['Importe','Período Inicial']*['Porcentaje','Jan'];

#['Importe','Feb']=['Importe','Jan']*['Porcentaje','Feb'];

#['Importe','Mar']=['Importe','Feb']*['Porcentaje','Mar'];

#['Importe','Abr']=['Importe','Mar']*['Porcentaje','Abr'];

#['Importe','May']=['Importe','Abr']*['Porcentaje','May'];

#['Importe','Jun']=['Importe','May']*['Porcentaje','Jun'];

#['Importe','Jul']=['Importe','Jun']*['Porcentaje','Jul'];

#['Importe','Ago']=['Importe','Jul']*['Porcentaje','Ago'];

#['Importe','Sep']=['Importe','Ago']*['Porcentaje','Sep'];

#['Importe','Oct']=['Importe','Sep']*['Porcentaje','Oct'];

#['Importe','Nov']=['Importe','Oct']*['Porcentaje','Nov'];

#['Importe','Dec']=['Importe','Nov']*['Porcentaje','Dec'];

I present an image that represents a little of what I'm doing.
Dibujo.JPG
Dibujo.JPG (44.69 KiB) Viewed 3122 times

Thank you very much
Regards

Re: Rules

Posted: Tue Aug 10, 2010 3:05 pm
by AWILDE
Hi,

In order to look at the prior period you can set up an attribute for your time dimension called "prior_period" and type in the prior period element names.

You can then write a rule to refer to that attribute as follows:

ATTRS('Time',!Time,'prior_period')

Re: Rules

Posted: Tue Aug 10, 2010 3:12 pm
by Neil Watson
Santiago,

You have the right idea, but it can be made so much easier by using attributes on the dimension instead of DIMIX and DIMNM.
In Server Explorer, Select dimension Periodos, right click edit element attributes
Select Edit-> Add New attribute, selct Text, call it Previous and another called Next

Previous
Jan = Periodo Inicial
Feb = Jan
Mar = Feb
Abr = Mar
etc

Next
Periodo Inicial = Jan
Jan = Feb
Feb = Mar
etc

then your rules,

['Importe', 'Periodo Inicial'] = stet; #this allows for input
['Importe'] = N: ['Porcentaje'] * DB('Precios', attrs('Periodos', !Periodos, 'Previous'), !Versiones, !Year !Medidas_Precio);


feeders;
['Importe','Periodo Inicial'] => DB('Precios', attrs('Periodos', !Periodos, 'Next'), !Versiones, !Year !Medidas_Precio);
#This feeder only works fully if you have a value in Periodo Inicial and no breaks in the data e.g. May = 0
or you'll have to feed the whole year
['Importe', 'Periodo Inicial'] =>
['Jan'],
['Feb'],
['Mar']....

or
['Importe','Periodo Inicial'] => ['Full Year']; # although it's better to try to not feed consolidations points to avoid over feeding

HTH
Neil

Re: Rules

Posted: Wed Aug 11, 2010 1:14 pm
by Santiago
Thank you very much for the answers. But I think the following rule solves a lot better this example:
['Importe', 'Periodo Inicial'] = stet;
['Importe','Forecast','2010']=N:DB('Precios2',DIMNM('Periodos2',DIMIX('Periodos2',!Periodos2)-1),
!ProductsDimension,!Versiones,!Year,'Importe')*['Porcentaje'];
At the end I think I could do.

Regards