Page 1 of 1

Rule for Attribute cube for Months with a current month flag

Posted: Tue Jun 14, 2011 1:41 am
by BigG
Hi, I have a Current Month flagged "Y" in my Month dim. I would like to apply logic through a rule in the attribute control cube to another attribute Act_For saying if Current Month or greater then type "F" in Act_For else "A". I also have a Month_Number I can use as an 'index' of sorts. Dont know if this is possible but if anyone has some suggestions then great...

Re: Rule for Attribute cube for Months with a current month

Posted: Tue Jun 14, 2011 2:14 am
by Martin Ryan
I think the below should work. In pseduo code
- Set the first month to Actuals
- Write a rule so that the first month after the current month is forecast
- All other months can just be the same as whatever last month was.

I've used a "Prev" attribute, but I guess you could make your index work too. Though might not be as straightforward.

Code: Select all

# Set the very first month to 'A' manually.  Or can do via rule if you have no feeders.
['Act_For', 'Month 1] = S: stet;

['Act_For'] = S:
if(attrs('Month', attrs('Month', !Month, 'Previous'), 'CurrentMonth')@='Y', 'F',
DB('ThisCube', attrs('Month', !Month, 'Previous'), 'Act_For'));
HTH

EDIT: I should have read closer, you said the current month was forecast, not actuals. Logic still applies though...

Re: Rule for Attribute cube for Months with a current month

Posted: Tue Jun 14, 2011 4:07 am
by BigG
Simple as it is inthe end, it took me a couple of reads ...but I finally got it, Will give that a go, thanks Martin