Rules Question on Calculation by Level

Post Reply
cberg
Posts: 4
Joined: Fri Aug 28, 2015 1:51 pm
OLAP Product: TM1
Version: 9+5
Excel Version: 2007

Rules Question on Calculation by Level

Post by cberg »

Is there a way to restrict a calculation to two specific levels using a rule.

Right now I have a formula to determine what percent of people want to buy different flavors of ice cream

['Purchase%_Total']=C:['IcecreamSold_Units']\['IcecreamAvail_Units'];

I want to restrict the C: calculation to levels 4 and 3 of my [SKU] dimension and force the result of 3 into levels 2 and 1 and 0.

Is this possible everything I have read seems to indicate that it's either all Consolidated Levels, Just the N level or Everything.


CBerg
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Rules Question on Calculation by Level

Post by declanr »

You can use an if statement and ELLEV function on the right hand side.
Declan Rodger
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Rules Question on Calculation by Level

Post by tomok »

Read up on the rules function ELLEV.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
cberg
Posts: 4
Joined: Fri Aug 28, 2015 1:51 pm
OLAP Product: TM1
Version: 9+5
Excel Version: 2007

Re: Rules Question on Calculation by Level

Post by cberg »

Great thanks I can isolate the levels


['Purchase%_Total']=IF(ELLEV('d.sku',!d.SKU)>2,['IcecreamSold_Units']\['IcecreamAvail_Units'],[ELLEV('d.sku',!d.SKU)=3,'IcecreamSold_Units']\ELLEV[d.sku',!d.SKU)=3'IcecreamAvail_Units']));


What I am struggling with is how to push the level 3 results into levels 2 through 0.

Chris
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Rules Question on Calculation by Level

Post by tomok »

cberg wrote:What I am struggling with is how to push the level 3 results into levels 2 through 0.
Here's the issue in a nutshell: In TM1 Rules, just like formulas in Excel, you don't write formulas to push something down, you write formulas to pull something in. For example, if you had an empty cell in Excel, let's say C3, and you wanted to pull into it the value from A1 (the same thing as pushing the value from A1 to C3) you wouldn't write the formula in A1 and say "push this down to C3"? No, you would write the formula in C3 and say "pull in from A1".

Your example is the same. Instead of pushing down you need to pull in. For levels 0, 1, and 2, you need to write your formula to pull in from their respective parents, working your way up the chain to levels 3 and 4. Something like this:

Code: Select all

['Purchase%_Total']=IF(ELLEV('d.sku',!d.SKU) < 3, DB(CubeName, !Dim1, !Dim2, !Dimn, !d.SKU, ELPAR('d.SKU, !d.SKU,1), 'Purchase%_Total');
This is not the exact code because I don't know the dimensionality of your cube and I don't know how many trees you have in the d.SKU dimension but this should give you an idea as to how it would be done.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Post Reply