Different rules need to be taken in account for 1 measure

Post Reply
bmeer31
Posts: 3
Joined: Wed Oct 13, 2010 1:32 pm
OLAP Product: TM1
Version: 9.5
Excel Version: 2003

Different rules need to be taken in account for 1 measure

Post by bmeer31 »

Hi,

we have the following challenge in our company model:
One measure KG need to be calculated by using different rules.

The activation of rules is leading by dimension elements.

Our challenge in rules:

Element FS + AREA#1 till AREA#4

['KG DAY',{'FS'}, {'AREA#1','AREA#2','AREA#3','AREA#4'}] = N:ROUNDP(if (['DAY % (REG)'] + ['CTR % (REG)'] = 0,
if (['DAY % (QAD)'] + ['CTR % (QAD)'] = 0,0,['DAY % (QAD)']),['DAY % (REG)']) * ['KG (DEM)'],0);

Element FS + AREA#5 till AREA#10

['KG DAY',{'FS'}, {'AREA#5','AREA#6','AREA#7','AREA#8','AREA#9','AREA#10'}] = N:ROUNDP(if (['DAY % (CUS)'] + ['CTR % (CUS)'] = 0,
if (['DAY % (REG)'] + ['CTR % (REG)'] = 0,0,['DAY % (REG)']),['DAY % (CUS)']) * ['KG (DEM)'],0);


The AREA elements are part of a dimension hierarchy and is not de lowest level. The total hierarchy consist out of 5 levels and Area is the 4th level.

Our calculation needs to work up to lowest level (level 0).
With the rules we don't get the right results. Results are only shown up to Area level.

Can someone give use advise?

Thanks,

Barbara
User avatar
Michel Zijlema
Site Admin
Posts: 712
Joined: Wed May 14, 2008 5:22 am
OLAP Product: TM1, PALO
Version: both 2.5 and higher
Excel Version: 2003-2007-2010
Location: Netherlands
Contact:

Re: Different rules need to be taken in account for 1 measur

Post by Michel Zijlema »

Hi Barbara,

Probably the easiest way to do this is to add an attibute to the dimension containing the AREA# elements, defining the calculation method on the lowest level and then use a rule that checks this attribute, f.i.:

['KG DAY','FS'] = N:
IF(AttrS('areadim',!areadim, 'CalcMethod') @= 'type1',
ROUNDP(if (['DAY % (REG)'] + ['CTR % (REG)'] = 0, if (['DAY % (QAD)'] + ['CTR % (QAD)'] = 0,0,['DAY % (QAD)']),['DAY % (REG)']) * ['KG (DEM)'],0),
ROUNDP(if (['DAY % (CUS)'] + ['CTR % (CUS)'] = 0, if (['DAY % (REG)'] + ['CTR % (REG)'] = 0,0,['DAY % (REG)']),['DAY % (CUS)']) * ['KG (DEM)'],0));


Michel
kpk
MVP
Posts: 214
Joined: Tue Nov 11, 2008 11:57 pm
OLAP Product: TM1, CX
Version: TM1 7x 8x 9x 10x CX 9.5 10.1
Excel Version: XP 2003 2007 2010
Location: Hungary

Re: Different rules need to be taken in account for 1 measur

Post by kpk »

You can split the calculation on the other side of the rule with a conditional statement.
I mean you can define an attribute (probably a A/B flag enough in your case) for each AREA elements and use that flag to define the required calculation.
You can use the ELPAR() function instead of the ATTRS() if you are sure that there is only one parent for each element or the order of the parents are fixed and will be not changed.

['KG DAY',{'FS'}] = N:
IF(ATTRS('AREA',!AREA,'TYPE')@='A',
ROUNDP(if (['DAY % (REG)'] + ['CTR % (REG)'] = 0,
if (['DAY % (QAD)'] + ['CTR % (QAD)'] = 0,0,['DAY % (QAD)']),['DAY % (REG)']) * ['KG (DEM)'],0),
ROUNDP(if (['DAY % (CUS)'] + ['CTR % (CUS)'] = 0,
if (['DAY % (REG)'] + ['CTR % (REG)'] = 0,0,['DAY % (REG)']),['DAY % (CUS)']) * ['KG (DEM)'],0)
);
Best Regards,
Peter
bmeer31
Posts: 3
Joined: Wed Oct 13, 2010 1:32 pm
OLAP Product: TM1
Version: 9.5
Excel Version: 2003

Re: Different rules need to be taken in account for 1 measur

Post by bmeer31 »

Thanks for your replies!

Regards,

Barbara
Post Reply