TM1 Tutorials.com

Implementing TM1 since 2005

  • Home
  • CubeSpy TM1 Monitor
  • Share Your Knowledge!
RSS

3 Types of Rules TM1 Developers should know

Posted on August 17, 2011 by Ben Hill
3 CommentsLeave a comment

We’ve gone through our notes for training our staff and aside from basic equation rules we have listed three classes of common rules which TM1 Developers should be familiar with. If you haven’t ever had to write one of these rules before, you should try it – it would be good practice, because we’ve all seen [‘Sales $’] = N: [‘Units’] * [‘Price’] example far too many times!

I’ve boiled it down to 3 types of rules which every consultant should at least know how to write.

  • Allocation/Phase Rule – e.g. Allocate our budgeted sales across States based on the Actual Sales ratio.
  • Rolling Value Rule – e.g. Opening (Measure) is equal to the Closing of the prior period. Often used in Balance Sheet or Depreciation rules.
  • Averaging Rule (C Level) – e.g. Averaging Percentages or Rates up all hierarchies within the cube.

As with TM1 and Platform Software in general, there is a million ways to do anything, so don’t be upset if we don’t follow your exact methodology.

Allocation/Phase Rule

This is a common requirement often seen in budgeting rules to allocate/phase an annual budget across months based on Calendar Days, Working Days or Last Year’s Actual Values for the given account.

Here is a sample rule which will phase an annual budget across months based on the number of working days in each month.

[{'Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May','Jun'},'Budget','$'] = N:
IF( ['Annual'] <> 0 ,
IF( DB('General Ledger',!Year,'Annual',!Scenario,!Department,!Account,'Phasing') @= 'Even Phasing' ,
['Annual'] \
DB('Assumption',!Year,'All Months','Actual','Unspecified Department','Working Days') *
DB('Assumption',!Year,!Month,'Actual','Unspecified Department','Working Days')
, CONTINUE )
, CONTINUE ) ;

There is a number of different ways to write this. For example I could exclude the {} Months from my rule filter (scope) and filter using an ELISANC within an IF Statement to check that the month element of the current cell being calculated is a descendant of the ‘All Months’ Element but that would clutter the rule tracer when/if used later on the ‘Annual’ Element.

With a rule like this you would need a complex feeder right?

Wrong. We will only have to calculate a month if there is a value in the ‘Annual’ month (which is a posting element for annualized data) within the same year. Which means our feeder can simply be:

[‘Annual’,’Budget’,’$’] => [‘All Months’]; 

This could also be written in long hand:

[‘Annual’,’Budget’,’$’] =>
[‘Jan’], [‘Feb’], [‘Mar’], [‘Apr’] … [‘Dec’];

Rolling Value Rule

Calculating a Balance Sheet, Net Book Value or Depreciation? This rule logic is bound to come up. This methodology is going to be slightly different depending on how you have your Time Dimension(s) set up within your cube.

Firstly there are even more possible solutions here, but we are aiming for a sustainable example which means we will be avoiding DIMNM(DIMIX()-1) in favor of using attributes to help move around periods.

We’ll take a customer subscription calculation as our example here and assume the cube for this rule has a separate Year and Month dimension.

Given a measures dimension which looks like this:

  • Closing Subscriptions
    • Opening Subscriptions
    • New Subscribers
    • Subscriber Churn (Displayed as a positive sign, aggregated with a -1 Weighting)

And a clever little attribute table on the Month Dimension:

Sample Attribute Table to assist Rolling Value Rules.

Sample Attribute Table to assist Rolling Value Rules.

 

 

A rule can then be written which looks like this:

[{'Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May','Jun'},'Forecast','Opening Subscriptions'] = N:
DB('Subscription',
STR(NUMBR(!Year) - ATTRN('Month',!Month,'Prior Year Component'),4,0) ,
STR(NUMBR(ATTRS('Month',!Month,'Month Number')) - ATTRN('Month',!Month,'Prior Month Component'),2,0) ,
!Scenario,!Department,!Product,'Closing Subscriptions');

This is what I would class as a bare bones rule for Rolling a Value. This should go back as far as the Year dimension’s elements will go and has not potential to create a circular reference like DIMNM(DIMIX()-1) methodology.

If you want to post an opening amount into the first month and first year within your TM1 cube you can use an additional check to see if the generated Year exists using the DIMIX function, if it doesn’t a STET will make the cell editable.

[{'Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May','Jun'},'Forecast','Opening Subscriptions'] = N:
IF( DIMIX('Year', STR(NUMBR(!Year) - ATTRN('Month',!Month,'Prior Year Component'),4,0)) = 0 , STET ,
DB('Subscription',
STR(NUMBR(!Year) - ATTRN('Month',!Month,'Prior Year Component'),4,0) ,
STR(NUMBR(ATTRS('Month',!Month,'Month Number')) - ATTRN('Month',!Month,'Prior Month Component'),2,0) ,
!Scenario,!Department,!Product,'Closing Subscriptions')
);

And then the feeders for this involve the same amount of coding but the theory can be daunting for people still learning. This is because where the rule went back across time periods to get the value, the feeder has to go forwards across time periods to push the value into the rule calculation cell.

[{'Jul','Aug','Sep','Oct','Nov','Dec','Jan','Feb','Mar','Apr','May','Jun'},'Forecast','Closing Subscriptions'] =>
DB('Subscription',
STR(NUMBR(!Year) + ATTRN('Month',STR((NUMBR(ATTRS('Month',!Month,'Month Number'))-13)*-1,2,0),'Prior Year Component'),4,0) ,
STR(NUMBR(ATTRS('Month',!Month,'Month Number')) + ATTRN('Month',STR((NUMBR(ATTRS('Month',!Month,'Month Number'))-13)*-1,2,0),'Prior Month Component'),2,0) ,
!Scenario,!Department,!Product,'Opening Subscriptions');

This could be written simpler if we didn’t piggyback the same “Prior Year” Attributes and instead added new “Next Year” Attributes. The above example feeder has a minimalistic approach to attributes but is paying for it in rule complexity.

Also I’m using a filter of each month because I have other N level elements in my month dimension which I do not want this rule applied to.

 

Averaging Rule (C Level)

This is something which should be very easy to do, but TM1 couldn’t easily handle it before version 9.5.2. TM1 9.5.2 now supports an averaging function among other new rule and TI functions you can check out here. I’ll show examples of the old methodology and the new also.

C  Level (Consolidation Level) rules which do averaging are very similar to normal rules but the reason we have them listed is because people don’t realize until they have to write one that a (non-zero value) counter measure is needed and you need to use a separate measure to perform the calculation in most cases.

Legacy Method – For averaging a value based on a counter.

['Average Price'] = C:
['Price'] \ ['Product Count'];
['Product Count'] = N:
IF( ['Price'] > 0 , 1 , 0 );

Feeder:

['Price'] =>
['Product Count'],
['Average Price'];

I’m using price and not units for my product counter as I want to average all prices regardless of if the product is sold in the specific period. If I wanted an average price pro rata units sold I would back solve my revenue equation like so.

['Average Price'] = C:
['Subscription Revenue'] \ ['Closing Subscriptions'];

Feeder:

['Closing Subscriptions'] =>
['Average Price'];

New Function Method – Averaging based on the data within a measure.

['Average Price'] = ConsolidatedAvg(2,'Subscription',!Year,!month,!Scenario,!Department,!Product,'Price');

Feeder:

[‘Price’] =>
['Average Price'];

The first argument of the ConsolidatedAvg function can be set as either:

  • 0 – consider all cells while averaging.
  • 2 – Ignore blank cells while averaging

 

Please feel free to comment any mistakes you see in the above workings or on any areas which need further clarification.

 

  • Share this:
  • Email
  • Print
Categories: IBM Cognos TM1 | Tags: Allocation, Developer, IBM Cognos TM1, Phasing, TM1 Consultants, TM1 Cube Rules
Notice: This work is licensed under a BY-NC-SA. Permalink: 3 Types of Rules TM1 Developers should know
Migrating from Enterprise Planning to TM1
TM1 Perspectives (for Excel) Report Methods

3 Responses to “3 Types of Rules TM1 Developers should know”

  1. Ravi says:
    February 17, 2012 at 3:51 pm

    I think the following is wrong

    •Rolling Value Rule – e.g. Closing (Measure) is equal to the Opening of the prior period. Often used in Balance Sheet or Depreciation rules.

    It should not be prior period must be next period

    Reply
  2. Ben Hill says:
    February 18, 2012 at 10:06 am

    Thanks for that – Updated.

    Reply
  3. tm1user says:
    November 14, 2012 at 11:30 pm

    fyi,
    There is an issue with the ConsolidatedAvg. (PM 42139) Reported as fixed in 10.1

    http://www-01.ibm.com/support/docview.wss?uid=swg1PM42139

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*


question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Authors Profiles

    Regular Authors:







    Guest Authors:
  • TM1 Tutorials Pages

    • CubeSpy TM1 Monitor
    • Share Your Knowledge!
  • Recent Posts

    • Woohoo! TM1 Tuts has cracked 100,000 visits!
    • Your Lifeline, The TM1 Transaction Log
    • Creating basic Top 10 reports using MDX expression
    • How to write easily understood Turbo Integrator code
    • Broken Transaction Log?
    • Removing old TM1 Servers from “Services”
    • Turbo Integrator Syntax Highlighter (Notepad++)
    • Messaging users of IBM Cognos TM1
    • Back to Basics – Regions in Rules
    • Cognos Insight – Aligning using the Grid
    • Automating Data Transfers between TM1 Servers
    • TM1 10.1 – IBM Cognos Insight Review Pt 2
    • The [Black Box] Killer
    • Free Trial of Cognos Insight – Big Data Analytics
    • TM1 Contributor – Single Security Hierarchy
  • TM1 Tutorials Links

    • Analytics Zone for all things about Cognos Insight and a free trial version.
    • InfoCube Premier Management Consulting on Cognos Products
    • Report Ready – and Waiting! Report Distribution Management – Track PDF Report Consumption by Channel
    • TM1 Networking – Sydney Meetup The meetup group for TM1 in Sydney, Australia
    • TM1 Tutorials on LinkedIn
    • TM1 Tutorials on Twitter Us on Twitter!
    • TM1 Tutorials.com Our primary home on the interwebs
  • Twitter Roll

    • TM1 Get Together, anyone who has a passion for IBM Cognos TM1 solutions is welcome! RSVP today. http://t.co/cO4sXXhh3F 1 week ago
    • RT @Mbs_craig: Craig's MBS Daily is out! http://t.co/1LaEhUcup3 ▸ Top stories today via @IBMBAEdu 2 weeks ago
    • RT @IBMSoftware: New #IBMImpact blog: Forrester Research: Systems of Engagement Demand New Integration Solutions - And A New IT http://t.co… 4 weeks ago
    • RT @BP191: Surely not! Close to 90% of spreadsheet documents contain errors, a 2008 analysis of multiple studies suggests http://t.co/3lIC… 4 weeks ago
    • RT @TM1Australia: I'm hiring! IBM COGNOS TM1 SENIOR CONSULTANTS - SYDN at Cubic Resources - New Zealand #jobs http://t.co/q1UzKumMJR 4 weeks ago
  • Tags

    Active Form Analysis Assistance Big Data Budgeting Cognos Cognos Insight Cognos TM1 Comparative Analysis Corporate Planning CubeSpy Dashboard dynamic reporting ETL Excel ExecuteProcess IBM Cognos IBM Cognos Express IBM Cognos Insight IBM Cognos TM1 Implementing TM1 Installation Guide MDX NT Service Profit & Loss Profitability Analysis Server Monitor Statement of Work TI Process TM1 TM1 10.1 TM1 Consultants TM1 Cube Rules TM1 Development TM1 Installation TM1 Server TM1 Software TM1 Training TM1 Tutorial TM1 Web Transaction Log TurboIntegrator Turbo Integrator VBScript Wim Gielis
© TM1 Tutorials.com. Proudly Powered by WordPress | Nest Theme by YChong
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.