Page 1 of 1

Rule Efficiency

Posted: Thu Jul 09, 2020 9:57 am
by MarenC
Hi,

Which of the following rules is the more efficient or in the following case is there no real material difference? :

Code: Select all

['Forecast', 'Annual Revenue'] = N:
	(DB('Revenue', !Version, !Period, !Dept , 'Total Revenue')
	+ DB('Revenue', !Version, ATTRS('Period', !Period, 'Period n-1'), !Dept, 'Total Revenue')
	+ DB('Revenue', !Version, ATTRS('Period', !Period, 'Period n-2'), !Dept, 'Total Revenue'))
	* 4;

Code: Select all

['Forecast', 'Annual Revenue'] = N:
	 DB('Revenue',!Version, !Period | 'Previous', !Dept, 'Total Revenue') *4;
The second statement uses a consolidation, which has child of period, period -1 and period -2.

Maren

Re: Rule Efficiency

Posted: Thu Jul 09, 2020 11:03 am
by Wim Gielis
Performance-wise, go for the second option. Though there is N: and N: but you will have noticed that I guess, and also a parenthesis too much.

Re: Rule Efficiency

Posted: Thu Jul 09, 2020 11:13 am
by MarenC
thankyou Wim. (and what errors :D )

Just a follow up, how would you feed this statement. I was thinking I had 2 options, either take out the N: and make the rule apply to C and N level
or

Have 3 feed lines one for each period, so one current period, 2 next period

Maren

Re: Rule Efficiency

Posted: Thu Jul 09, 2020 11:49 am
by Wim Gielis
Feed the underling N level cells ( 'Forecast', 'Annual Revenue' ) based on the driver values.
They will feed into the future 1/2 periods, or stay within the same period.
Or, use a different value to feed from, if you know that makes sense business-wise.

Re: Rule Efficiency

Posted: Thu Jul 09, 2020 5:39 pm
by scrumthing
Wim Gielis wrote: Thu Jul 09, 2020 11:03 am Performance-wise, go for the second option. Though there is N: and N: but you will have noticed that I guess, and also a parenthesis too much.
I would say second option as well. in general consolidation is faster for aggregation then rules because of the sparse consolidation algorithm and stuff... (please don't ask me for a detailed explanation. There are others here to explain it much better.)