# How to Limit TM1 Rule Scope (and speed up your model!)

We are working with a client where they have a forecasting model that goes out for 10 years by month. It includes labour planning by person, capex, detailed gross profit calculations etc. The whole model is driver based and rolls forward automatically, incrementing by inflation each year. Needless to say, it is a tad cumbersome when you view a 10 year Balance Sheet as everything needs to recalculate. The client asked the other day what we could do about performance and we suggested that we limit the scope of the rules to only the immediate budget year when that was all that was needed and then expand it out to the full Long Range Plan when they wanted to do 10 year forecasting.

## Tight TM1 Rules

In the model we had already limited the scope of the rules on the left so that we were only calculating the Forecast version dynamically (they only needed one active version). So invariably our rules include ‘Forecast’ on the left side, or we have a Stet rule at the top of the rule sheet that limits the scope of the rules to Forecast only.

We then suggested that we disable the rules for all the years beyond the required budget year and with a quick little change, we have dramatically sped up the model for day to day use (and they understand that it will be a little slow for 10 year plan use).

## Our Method to Limit Rule Scope

To limit the scope of the rules to only calculate for the required years all we did was three simple steps.

We first of all added a flag to our System Control cube called ‘LRP Active’. This is a simple 0 or 1 switch, where 0 means LRP is inactive.

Next, we added a rollup to our Year dimension called ‘LRP Years’ and put all years beyond the budget year as children to it.

Then finally, we created a rule that says:

## Disables all children of LRP Years when the LRP Active flag is set to zero (so it is Inactive)
[] = IF (DB('System Control','LRP Active','Value') = 0
,IF ( ELISANC ( 'Year' , 'LRP Years' , !Year ) = 1
,STET
,CONTINUE
)
,CONTINUE
);

What this does is tests if LRP Active is 0 or not. If it is Inactive, then it tests if the year is child to LRP Years. Then, if it is, then the rules are set to STET. Finally, if not, then the rule sheet continues.

Sweet!