I have the following data (simplified sample):
- Time: JAN; Quantity: 3
- Time: FEB; Quantity: 5
- Time: MAR; Quantity: 6.5
Now I have a task to calculate 'linear trend' for months APR to DEC.
How to mathematically calculate trend I have found web page: http://classroom.synonym.com/calculate- ... -2709.html
According to above web page (my sample is exactly the same as above web page suggests) I have created 10 dummy measures and wrote rules. See bellow image and rules.
TM1 model works fine, correct values, but just wondering is there some other simpler way to create a linear trend line?
My system: Cognos TM1 Architect accessing Cognos TM1 10.1.1 fixpack 2 on Windows server.
Regards
=== RULES ===
Code: Select all
SKIPCHECK;
# n
['DUMMY3']=
N: STET;
C: IF(DTYPE('TEST_TIME',!TEST_TIME) @='N', STET,
DB('TEST',
!TEST_MEASURES,
ELCOMP('TEST_TIME',!TEST_TIME,ELCOMPN('TEST_TIME',!TEST_TIME))
)
)
;
#a
['DUMMY4'] = N: ['DUMMY3'] * ['QUANTITY'] * ['DUMMY1']; C:STET;
#b
['DUMMY5'] = ['QUANTITY'] * ['DUMMY1'];
#c
['DUMMY6'] = N: ['DUMMY3'] * ['DUMMY1'] * ['DUMMY1']; C:STET;
#d
['DUMMY7'] = ['DUMMY1'] * ['DUMMY1'];
#m
['DUMMY8'] = (['DUMMY4'] - ['DUMMY5']) / (['DUMMY6'] - ['DUMMY7']);
#e is ['QUANTITY', 'TIME']
#f
['DUMMY9'] = ['DUMMY8'] * ['DUMMY1'];
#g
['DUMMY10'] = (['QUANTITY'] - ['DUMMY9']) / ['DUMMY3'];
# Calculated linear trend
['APR', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
['MAY', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
['JUN', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
['JUL', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
['AUG', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
['SEP', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
['OCT', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
['NOV', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
['DEC', 'QUANTITY'] = ['TIME', 'DUMMY8'] * ['DUMMY2'] + ['TIME', 'DUMMY10'];
FEEDERS;
['QUANTITY']=>['DUMMY4'];
['QUANTITY']=>['DUMMY5'];
['DUMMY1']=>['DUMMY6'];
['DUMMY1']=>['DUMMY7'];
['DUMMY6']=>['DUMMY8'];
['DUMMY7']=>['DUMMY8'];
['DUMMY1']=>['DUMMY9'];
['DUMMY3']=>['DUMMY10'];