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
How to write an if logic to calculate measure?
-
- Posts: 133
- Joined: Thu Mar 25, 2010 8:34 am
- OLAP Product: Cognos TM1
- Version: 9.5.2
- Excel Version: 0
How to write an if logic to calculate measure?
- Attachments
-
- unit.png (7.15 KiB) Viewed 2669 times
- qml
- MVP
- Posts: 1096
- Joined: Mon Feb 01, 2010 1:01 pm
- OLAP Product: TM1 / Planning Analytics
- Version: 2.0.9 and all previous
- Excel Version: 2007 - 2016
- Location: London, UK, Europe
Re: How to write an if logic to calculate measure?
You do not even need any IF statements here, so basic is your requirement.
I will let you figure out the feeders for yourself.
Code: Select all
['unit1','measure3'] = N: [measure1] - [measure2];
['measure3'] = N: ['measure1'];
Kamil Arendt
-
- Posts: 133
- Joined: Thu Mar 25, 2010 8:34 am
- OLAP Product: Cognos TM1
- Version: 9.5.2
- Excel Version: 0
Re: How to write an if logic to calculate measure?
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:
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
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'];
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