Page 1 of 1

Feeders for Balance Calculations

Posted: Tue Sep 28, 2010 8:13 pm
by PlanningDev
Ive searched for feeding balances across the board but I still can't seem to figure out the best way to feed what Im trying to do.

The cube has a month dimension and a year dimension.

The rule is written such that there is a STET for Jan and 2008 which is where I have to manually enter the balance to get it started.
The issue then is that for all other months and years the rule picks up the prior months number and adds to it. The rule for this works but how do I feed the calculated items when the only hand entered item is in Jan 2008?

The below code doesn't work and Ive tried variation of it as well.

Code: Select all

['Subs','Jan','2008']=>['Subs'];

Re: Feeders for Balance Calculations

Posted: Tue Sep 28, 2010 8:56 pm
by David Usherwood
Think you need to have a Year total in the Month dimension and feed to that:

Code: Select all

['Subs','Jan']=>['Year'];

Re: Feeders for Balance Calculations

Posted: Tue Sep 28, 2010 8:59 pm
by Wim Gielis
Hello

You can have a text attribute on the month dimension, containing the 'next month'.

Then, use a DB() function on the right hand side of the feeder. For the month argument, feed to that next month (ATTRS(dim, !elem, 'next month'))

Don't forget to feed to the next year if you are on the 'December element'.

Wim

Re: Feeders for Balance Calculations

Posted: Tue Sep 28, 2010 9:49 pm
by tomok
This is pretty simple, the only requirement is that you have a rollup in both the month and year dimension that add up all the n-level elements, if you don't already. For example, you need a "Year" element in the month dimension that is a sum of all the months (or a sum of the quarters which is a sum of the months). Then you need an element in the Year dimension that adds all the years together like "All_years". It doesn't matter that this element doesn't make sense from a data standpoint, you're only going to use it in the feeder code. Then the feeder statement would look like this:

['Subs','Jan','2008']=>['Subs','Year','All_years'];

No need for any special attributes or anything like that. This feeder will not need updating. Just make sure to add any new years you add to Year dimension to the "All_years" node whenever you do maintenance on the dimension.

Re: Feeders for Balance Calculations

Posted: Tue Sep 28, 2010 9:53 pm
by PlanningDev
Im not sure if I did this right but it ultimately took 3 feeder statements.
1. Had to feed the year where the primer entry was manually entered (Jan, 2008)
2. Had to feed Dec of prior to Jan of current year
3. Had to feed current year Jan through Dec

I do realize that I can target sub total with a feeder which feeds all the N levels. In this sense, I wanted to know how to answer this problem without creating a dummy rollup in the years dimension in order to have a feeder target for all years.

Assuming I don't have a rollup for years does having 3 feeders for what im doing seem to make sense?

Re: Feeders for Balance Calculations

Posted: Wed Sep 29, 2010 2:02 am
by Gregor Koch
Hi
:shock:
Still coughing up coffee after reading this from the previous post:

['Subs','Jan','2008']=>['Subs','Year','All_years'];

Which is basically the worst overfeeding you can do in this example, just to mention that you are unnecessarily feeding all years prior to 2008 as well.

You don't necessarily need to create a 'All Years' (or 'All Months' for that matter) to feed your rule, let alone that it is not recommendable to use especially ‘All Years’ in the first place.
The way you write a Feeder for this is also dependent on how many years out (in the future) you want to actually feed and I would put in a condition in your feeder which checks this.
If you need to push your Balance 20 Years out (eg in a Mining Model) then maybe you should consider a different way of writing your feeder.

I usually create a 'Time' cube which creates an Index for any Month-Year combination. This usually has the Year, Month and a Measure dimension. In this I also store the following and previous Month for a Month and the following and previous Year for a Month-Year combination. With that I can easily say that the month I need to feed from, say, Dec-2008 feeds Jan-2009 (or usually Opening Balance but that depends on whether you store the balance or the movement against the Month element) and also whether a month is in a certain range.

But let’s just say you only need to feed 5 Years because that was the scope of your Budget then a feeder like this will work just fine.

['Subs']=>DB(
IF(Range of Index comparison ,cubename,’’),DB(‘Time’, !Year, !Month, ‘Next Year’), DB(‘Time’, !Year, !Month, ‘Next Month’), ‘Subs’);

I have simplified the comparison of the indexes. It basically says: check whether the feeding month is greater or equal to Jan 2008 and less than say Dec 2012.
You could also leave 'Jan', '2008' in the left side which possibly would improve start up and rule save time but unless it is an issue I'd opt not to hard code a year in a rule.
If you do feel comfortable to have a go at conditional feeders and the above assumption of the scope is fitting then post the full dimensionality of your cube(s) and I am happy to assist.

Cheers

Re: Feeders for Balance Calculations

Posted: Wed Sep 29, 2010 2:07 am
by Gregor Koch
And, yes, I am aware that you could create a consolidation in the year dimension which only has years in it which need to be fed.
Cheers