Page 1 of 1

subtracting months

Posted: Mon Mar 31, 2014 1:59 pm
by Kazêh
Hi all, i have a measure dimension and a months dimension, and others too , but for my example I will mention only those two.

what i want to do is to subtract the value of the month to the previous month

example:

Jan = Feb-Jan
Feb= Mar- Feb
Mar= Abr- Mar

etc...

what i tho i could do was this
create an atribute named previous month as string and add the months and make the diference.

Something like this:


['Measure A'] = N: DB('Cube1',!Dim1,!Dim2, !Dim3,!Months) - DB('Cube1',!Dim1,!Dim2, !Dim3,attrs('Months',!Months,'previous month');
i tryed that but i got 0's , I think I need an accountant or something to make it move between months, but I wonder if the logic is well underway

Just so you know my months measure is like: Jan,Feb,Mar,Apr,May....etc.

any tips will be appreciated

Thanks.

Kazeh.

Re: subtracting months

Posted: Mon Mar 31, 2014 2:16 pm
by qml
If someone attempted to solve your equations they would receive the following results:
Jan = Feb-Jan -> Feb = 0
Feb = Mar-Feb -> Mar = 0

Not to mention that your example is in direct contradiction to your description: "what i want to do is to subtract the value of the month to the previous month".

But that aside, this is not the sort of calculation you want to be doing using rules (for a number of reasons that have been mentioned to death on this forum). You should consider creating consolidations in the month dim:

Feb Mvt
+Feb
-Jan

Mar Mvt
+Mar
-Feb

etc.

Re: subtracting months

Posted: Mon Mar 31, 2014 2:21 pm
by Kazêh
xD, sorry y english is not very good, but i get the idea, im looking to the other post if i find a way to do this.
thanks

Re: subtracting months

Posted: Mon Mar 31, 2014 3:39 pm
by qml
Kazêh wrote:xD, sorry y english is not very good, but i get the idea, im looking to the other post if i find a way to do this.
thanks
You are most welcome. Not quite sure though what other information you want to find elsewhere. Surely creating some consolidations with weightings is relatively easy?