Page 1 of 1

How to write an if logic to calculate measure?

Posted: Mon Feb 25, 2013 2:48 pm
by abcuser
Hi,
using TM1 v9.5.2 I have a cube with several dimensions, but two of them are important (measures and organization_unit). Measure3 is calculated in the following way: if organization_unit is unit1 then measure3 = measure1 - measure2 for all other organization units measure3 = measure1.

See attached simple sample.

How to write a calculation rule for measure3?
Regards

Re: How to write an if logic to calculate measure?

Posted: Mon Feb 25, 2013 2:56 pm
by qml
You do not even need any IF statements here, so basic is your requirement.

Code: Select all

['unit1','measure3'] = N: [measure1] - [measure2];
['measure3'] = N: ['measure1'];
I will let you figure out the feeders for yourself.

Re: How to write an if logic to calculate measure?

Posted: Tue Feb 26, 2013 8:00 am
by abcuser
Hi,
this is exactly what I was thinking and it is not working in my case it produces magnitude of bigger values. It looks like my production cube is way more complicated (multiple calculations), so this simple sample was not the best way to present my problem.

To solve my production cube problem I have created dummy measure to help the process, so I did:

Code: Select all

SKIPCHECK;
['dummmy_measure','unit1']=['measure2', 'unit1'];
['measure3']=['measure1']-['dummy_measure'];

FEEDERS;
['measure2', 'unit1']=>['dummy_measure','unit1'];
['measure1']=>['measure3'];
['dummy_measure']=>['measure3'];
I must use formula without "N:" if not it just produces magnitude bigger values.

P.S. Now I have also created this simple sample from my first post and I see for simple sample your code is working fine (with feeders).
Thanks