Page 1 of 1

N and C rules

Posted: Wed Apr 20, 2011 9:02 am
by buoyant
Hello Everybody,

Am trying to calculate budget variance percentage. It works fine at 'N' level but doesn't at 'C' level.
Pls can you review the following code and help me.

Thanks :D


SKIPCHECK;

['Variance'] = N: ['Actual'] - ['Budget'] ;
['Variance'] = C: ['Actual'] - ['Budget'] ;

['%Variance'] = N: (['Variance'] \ ['Budget']) * 100;
['%Variance'] = C: (['Variance'] \ ['Budget']) * 100;

FEEDERS;
['Budget'] => ['Variance'];
['Actual'] => ['Variance'];
['Budget'] => ['%Variance'];
['Actual'] => ['%Variance'];

ADMIN NOTE: Moved from the useful code tips and tricks forums

Re: Averages for Consolidations

Posted: Wed Apr 20, 2011 9:39 am
by Wim Gielis
Hello buoyant

Put it on the same line:

Code: Select all

['Variance'] = N: ['Actual'] - ['Budget'] ; C: ['Actual'] - ['Budget'] ;
Please post in the correct subforum, not in the "Useful code, tips and tricks" subforum.

Wim

Re: Averages for Consolidations

Posted: Wed Apr 20, 2011 9:42 am
by Michel Zijlema
buoyant wrote:Hello Everybody,

Am trying to calculate budget variance percentage. It works fine at 'N' level but doesn't at 'C' level.
Pls can you review the following code and help me.

Thanks :D


SKIPCHECK;

['Variance'] = N: ['Actual'] - ['Budget'] ;
['Variance'] = C: ['Actual'] - ['Budget'] ;

['%Variance'] = N: (['Variance'] \ ['Budget']) * 100;
['%Variance'] = C: (['Variance'] \ ['Budget']) * 100;

FEEDERS;
['Budget'] => ['Variance'];
['Actual'] => ['Variance'];
['Budget'] => ['%Variance'];
['Actual'] => ['%Variance'];
Two remarks here:

If the calculation should work at all levels you don't need to specify the N: or C:, so
['%Variance'] = (['Variance'] \ ['Budget']) * 100;
will do.

If you just want to calculate the difference ['Actual'] - ['Budget'] I would advise you to make 'Variance' a consolidated element with components 'Actual' (weight 1) and 'Budget' (weight -1).

The fact that your above rules are not working for the C: part is probably because you need the AllowSeparateNandCRules parameter in your tm1s.cfg file (or rephrase like Wim just mentioned).

Michel

Re: Averages for Consolidations

Posted: Wed Apr 20, 2011 10:06 am
by buoyant
Thanks Wim it works.

Pls let me know what would be the appropriate subforum for this post, as i have another issue with the same topic.

Secondly, why did it work now and not with earlier code.

Thanks Michael it was a great suggestion, i would love to use it in my future designs.

Thanks again for yr help.

Regards

Re: Averages for Consolidations

Posted: Wed Apr 20, 2011 10:18 am
by Wim Gielis
You can create your new topic in this general subforum:

http://www.tm1forum.com/viewforum.php?f=3