TM1 Rule - Mixing And Or in a If Statement

Post Reply
kenship
Posts: 58
Joined: Thu May 30, 2013 1:41 pm
OLAP Product: Cognos
Version: TM1 10.2
Excel Version: 2010

TM1 Rule - Mixing And Or in a If Statement

Post by kenship » Fri Sep 01, 2017 3:52 pm

Hi,

I made myself into some trouble when using and mixing multiple & (AND) and % (OR) in a If condition.

Let me explain:
Condition A: Change Type
Condition B: Year

If (
A = Inflation
&
B = 2018
%
B = 2019
,1%
,STET)

I meant to put 1% in 2018+Inflation and 2019+Inflation then nothing for the rest.

I realize that the way I put the rule is confusing the years. And I have to split it into 2 rules.

I wonder whether there's a way to tie it in one rule without using multiple If.

Kenneth

User avatar
tomok
MVP
Posts: 2335
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: TM1 Rule - Mixing And Or in a If Statement

Post by tomok » Fri Sep 01, 2017 5:44 pm

You should never hard code rates into a rule like this. I know it is really easy but once you get a rule file full of this crap it's almost impossible to maintain or add onto. Make you inflation rate an attribute of the time dimension then no IFs ANDs or BUTs are needed.

kenship
Posts: 58
Joined: Thu May 30, 2013 1:41 pm
OLAP Product: Cognos
Version: TM1 10.2
Excel Version: 2010

Re: TM1 Rule - Mixing And Or in a If Statement

Post by kenship » Fri Sep 01, 2017 6:05 pm

It's just an example. It's not even about inflation at all.

The original rule is much much longer and I believe it's not helping to provide them.

My struggle is whether I can do a Inflation & 2018 AND Inflation & 2019 without using multiple Ifs or 2 rules.

Kenneth

declanr
MVP
Posts: 1541
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: TM1 Rule - Mixing And Or in a If Statement

Post by declanr » Fri Sep 01, 2017 6:31 pm

I think the high level concept you are trying to get to is just fixed by using brackets but I may not understand your question fully.

Code: Select all

['Measure']=N: If ( ( ['Thing'] = 1 % ['Thing'] = 2 ) & ( ['ymabob'] = x ), do stuff, do other stuff );

kenship
Posts: 58
Joined: Thu May 30, 2013 1:41 pm
OLAP Product: Cognos
Version: TM1 10.2
Excel Version: 2010

Re: TM1 Rule - Mixing And Or in a If Statement

Post by kenship » Fri Sep 01, 2017 6:38 pm

I'll try that, thanks a lot!

Post Reply