Page 1 of 1

Probably a stupid feeder question

Posted: Wed Aug 12, 2009 4:27 am
by rcoppa
Hi there,

I have created a rule that feeds and works as I expect:

Code: Select all

SKIPCHECK;
['Op Sup Ratio'] =  ['Total Operator'] / ['Total Support'];
FEEDERS;
['Total Operator'] =>['Op Sup Ratio'];
['Total Support'] =>['Op Sup Ratio'];
However when I add an if statement the consolidated values are no longer shown! N level is fine. This seems bizarre to me but im sure its something simple I'm missing.

Code: Select all

SKIPCHECK;
['Op Sup Ratio'] = if ( ['Total Support'] = 0 , 0 , ['Total Operator'] / ['Total Support']);
FEEDERS;
['Total Operator'] =>['Op Sup Ratio'];
['Total Support'] =>['Op Sup Ratio'];
Thanks in advance

Re: Probably a stupid feeder question

Posted: Wed Aug 12, 2009 4:38 am
by kangkc
You don't need to use "IF" looking at your logic, just use the "\" instead of "/"

TM1 rule will handle it well. See the rule guide:

\ (back slash) - Same as / (forward slash), but returns zero when you divide by zero, rather than an undefined value.

Re: Probably a stupid feeder question

Posted: Wed Aug 12, 2009 5:08 am
by rcoppa
Thankyou.

Using \ I still have no values appear in a consolidated view. If i use '/' the values appear correctly but i get some undefined (correct behaviour).

Re: Probably a stupid feeder question

Posted: Wed Aug 12, 2009 7:56 am
by par3
That is the point of using the "\". If your value can't be calculated (N/A) it returs a 0. That is probably what is happening at your consolidated level.

Re: Probably a stupid feeder question

Posted: Wed Aug 12, 2009 8:13 am
by David Usherwood
Also, don't feed from both sides of your ratio. Normally I feed from the denominator on the basis that if you have zero, you won't get a meaningful result. So.
SKIPCHECK;
['Op Sup Ratio'] = ['Total Operator'] \ ['Total Support'];
FEEDERS;
['Total Support'] =>['Op Sup Ratio'];

Strictly, since your calculation is at all levels, you don't need to feed it at all. If you slice to Excel you will get good numbers. But I admit that this makes life difficult for zero suppressed views so yes, I normally feed ratios like this.