Problem with calculation

marac2203
Posts: 12
Joined: Sat Mar 05, 2016 8:59 pm
OLAP Product: IBM Tm1
Version: 10.1.0
Excel Version: Office plus 2013

Problem with calculation

Post by marac2203 »

Hy! I need help with rule calculation in TM1:

I need to get value in cell HRK when I put number in EUR (Cube is named Radni sati)
EUR must be multiply with value in second cube named Tečaj. I got screenshots
Attachments
Tečaj 2.jpg
Tečaj 2.jpg (190.84 KiB) Viewed 9940 times
Radni sati 1.jpg
Radni sati 1.jpg (140.35 KiB) Viewed 9940 times
User avatar
qml
MVP
Posts: 1097
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: Problem with calculation

Post by qml »

Welcome to the forum. Please start by familiarising yourself with this post in order to know how to ask good questions and get good answers.

What have you tried already? No one is going to write your rules for you unless you show you have done some work yourself, especially that everything you need to know to solve this problem is in the basic examples in the TM1 Developer Guide. The screenshots you provided, as big as they are, don't really provide the crucial information about the cube structures (dimension names and order) that are needed to solve this problem.
Kamil Arendt
marac2203
Posts: 12
Joined: Sat Mar 05, 2016 8:59 pm
OLAP Product: IBM Tm1
Version: 10.1.0
Excel Version: Office plus 2013

Re: Problem with calculation

Post by marac2203 »

I have two cubes. Cube 1 with this order of dimensions: Projekt,Zaposlenik,Period,Scenarij,Valuta,Fakturiranje
and Cube 2 with this order of dimensions: Period,Scenarij,Konverzija,Valuta

Measure dimension in Cube 1 is: Fakturiranje with elements Fakturabilni sati and Nefakturabilni sati
Measure dimension in Cube 2 is: Konverzija with element Tečaj
Dimension Valuta has two elements with EUR and HRK

I wrote rule to calculate HRK value when you type number (value) in EUR in Cube 1.
When you write EUR value it need to be multiplay with value in cube 2 EUR

Cube 2 is currency converting cube for example if EUR in this cube is 7.5 it must
be muliply with EUR vale in cube 1 let's say 5 and get value HRK in cube 1.
In this example value should be HRK=7.5X5=37,5

My rule doesn'work. Rule is accepted but nothing happend

#Region System
FEEDSTRINGS;
SKIPCHECK;
#EndRegion
['HRK']=N:IF(['EUR']>0,['EUR']*DB('Tečaj',!Period,!Scenarij,'EUR'),0);
FEEDERS;
['EUR']=>['HRK'];
User avatar
qml
MVP
Posts: 1097
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: Problem with calculation

Post by qml »

No Cube 1 / Cube 2 nonsense, please. Let's use the real cube names as in your original post. You did not say which cube you put the rule in - it needs to be 'Radni sati'. I would change the code a bit. You don't need FEEDSTRINGS or that '>0' check. You also omitted one of the dimensions in your 'Tečaj' cube reference (it has 4 dims, not 3). Something like that should work:

Code: Select all

SKIPCHECK;
['HRK']= N: ['EUR'] * DB('Tečaj',!Period,!Scenarij,'Tečaj','EUR');

FEEDERS;
['EUR']=>['HRK'];
Now, it seems from your screenshots that you currently have no rule applied in 'Radni sati' as otherwise the 'HKR' cells should be greyed out. So make sure you save the rule correctly.
Kamil Arendt
marac2203
Posts: 12
Joined: Sat Mar 05, 2016 8:59 pm
OLAP Product: IBM Tm1
Version: 10.1.0
Excel Version: Office plus 2013

Re: Problem with calculation

Post by marac2203 »

I wrote your roule but unfortunatelly it doesn't work. Maybe piture can help.
Cube 1 is Radni sati
Cube 2 is Tečaj
Attachments
SLika 1.jpg
SLika 1.jpg (119.25 KiB) Viewed 9916 times
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: Problem with calculation

Post by declanr »

In your rule:

Code: Select all

['HRK']=N: ['EUR'] * DB('Tecaj',!Period,!Scenrij,'Tecaj',!Valuta);
The !Valuta reference will bring back the currency set on the left hand side of the rule (in this case "HRK"); the cube intersetion you have shown has a rate in "EUR"... presumably you want to point to "EUR" rather than "HRK".
Declan Rodger
User avatar
qml
MVP
Posts: 1097
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: Problem with calculation

Post by qml »

No, sorry, it's blatantly obvious from your screenshot that you did not use the code I provided. You changed it and that's why it's not working.
Kamil Arendt
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: Problem with calculation

Post by declanr »

It is worth noting that if you had right clicked on the target cell and selected "Trace Calculation" you would be able to see exactly where it is pulling values from.
Declan Rodger
Edward Stuart
Community Contributor
Posts: 248
Joined: Tue Nov 01, 2011 10:31 am
OLAP Product: TM1
Version: All
Excel Version: All
Location: Manchester
Contact:

Re: Problem with calculation

Post by Edward Stuart »

It is also worth noting that there is an Exchange Rates example in Chapter 3 of the Rules Guide

http://www-01.ibm.com/support/docview.w ... wg27041359

Not only this but the default Samples installed with Cognos TM1 also include the necessary objects from the Rules Guide to test creating the rules. In a standard install these files should be available here:

C:\Program Files\ibm\cognos\tm1_64\samples\tm1\Rules_Guide_Data
marac2203
Posts: 12
Joined: Sat Mar 05, 2016 8:59 pm
OLAP Product: IBM Tm1
Version: 10.1.0
Excel Version: Office plus 2013

Re: Problem with calculation

Post by marac2203 »

Hi! I really don't know why my rule formula doesn't work. I've read rules guide, but it doesn't help. Please anyone can help me to get right calculation.
If you look at the picture I need to get for example this value with rule
Cube named Uloga na projektu: HRK Cijena po satu=EUR Cijena po satu* EUR from Cube named Tečaj
So if we see Dražen horvat the value is 10*7,5=75 HRK I get nothing in HRK field?
Attachments
Slikovito.jpg
Slikovito.jpg (158.85 KiB) Viewed 9847 times
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: Problem with calculation

Post by declanr »

Have you tried tracing calculations on the target cell to see what it is doing as I suggested earlier? - This almost always gives away everything you need to know.

It could be the order of your dimensions; unless I have missed it somewhere in the thread I didn't notice the order of dims - this will be important for your DB reference that they are in the right order.
Declan Rodger
marac2203
Posts: 12
Joined: Sat Mar 05, 2016 8:59 pm
OLAP Product: IBM Tm1
Version: 10.1.0
Excel Version: Office plus 2013

Re: Problem with calculation

Post by marac2203 »

Here is the order of dimensions in both cubes:
Attachments
Uloga na projektu order.jpg
Uloga na projektu order.jpg (74.37 KiB) Viewed 9845 times
Tečaj order dimension.jpg
Tečaj order dimension.jpg (64.34 KiB) Viewed 9845 times
marac2203
Posts: 12
Joined: Sat Mar 05, 2016 8:59 pm
OLAP Product: IBM Tm1
Version: 10.1.0
Excel Version: Office plus 2013

Re: Problem with calculation

Post by marac2203 »

When I click trace calculation in Cube Uloga na projektu cube in intersection Dražen Horvat and HRK cijena po satu nothing happens
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: Problem with calculation

Post by declanr »

Your trace calc issue seems surprising. It does sometimes open a pop up window in a small box that you need to expand to a useable size.

Just noticed that your most recent screenshot only has 3 dimensions referenced in the "Tecaj" cube even though the cube has 4 dimensions and your earlier posts included 4 dimensions. Why have you gone back to removing one??

Have a look at re-ordering the statement (the one with all 4 dimensions referenced) to mimic the original order of dimensions instead of the re-ordered one.
Declan Rodger
marac2203
Posts: 12
Joined: Sat Mar 05, 2016 8:59 pm
OLAP Product: IBM Tm1
Version: 10.1.0
Excel Version: Office plus 2013

Re: Problem with calculation

Post by marac2203 »

I've adjusted new order with original one if you had meant that? I' also found pop up window to trace calculation. But unfortunally the problem is same:
Attachments
sve.jpg
sve.jpg (115.96 KiB) Viewed 9837 times
novi poredak 2.jpg
novi poredak 2.jpg (62.51 KiB) Viewed 9837 times
novi poredak 1.jpg
novi poredak 1.jpg (73.6 KiB) Viewed 9837 times
marac2203
Posts: 12
Joined: Sat Mar 05, 2016 8:59 pm
OLAP Product: IBM Tm1
Version: 10.1.0
Excel Version: Office plus 2013

Re: Problem with calculation

Post by marac2203 »

I also included all dimensions from referencing cube Tečaj in calculation.
babytiger
Posts: 78
Joined: Wed Jul 31, 2013 4:32 am
OLAP Product: Cognos TM1, EP, Analyst
Version: 10.2.2
Excel Version: 2013
Location: Sydney AU

Re: Problem with calculation

Post by babytiger »

Please check your rule trace screen, 3rd item, it is referencing to HRK, which is returning 0. While your rule is structured correctly, are the element references correct?
MK
User avatar
qml
MVP
Posts: 1097
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: Problem with calculation

Post by qml »

It is hard not to shout at this point, but I will try my best. I have given you the exact code that you just need to copy-paste and it will work. In each screenshot you are showing a slightly different version of the rule (and of the cubes!), none of which can work.

When the solution works, try and spend the time to understand why it does work and why your attempts didn't. Reading the guide that was already suggested to you will help greatly.

To summarise, you already received all the help you needed yesterday, now you just need to pay attention and apply it.
Kamil Arendt
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: Problem with calculation

Post by declanr »

As has now been mentioned quite a few times you need to reference 'EUR' in the DB statement; if you don't specify it will pull the same element on the left hand side.
Declan Rodger
babytiger
Posts: 78
Joined: Wed Jul 31, 2013 4:32 am
OLAP Product: Cognos TM1, EP, Analyst
Version: 10.2.2
Excel Version: 2013
Location: Sydney AU

Re: Problem with calculation

Post by babytiger »

qml wrote:It is hard not to shout at this point, but I will try my best. I have given you the exact code that you just need to copy-paste and it will work. In each screenshot you are showing a slightly different version of the rule (and of the cubes!), none of which can work.

When the solution works, try and spend the time to understand why it does work and why your attempts didn't. Reading the guide that was already suggested to you will help greatly.

To summarise, you already received all the help you needed yesterday, now you just need to pay attention and apply it.
Knew I heard someone screaming across town.
MK
Post Reply