Page 1 of 2
Problem with calculation
Posted: Thu Mar 10, 2016 1:29 pm
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
Re: Problem with calculation
Posted: Thu Mar 10, 2016 1:57 pm
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.
Re: Problem with calculation
Posted: Thu Mar 10, 2016 4:20 pm
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'];
Re: Problem with calculation
Posted: Thu Mar 10, 2016 4:37 pm
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.
Re: Problem with calculation
Posted: Thu Mar 10, 2016 5:04 pm
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
Re: Problem with calculation
Posted: Thu Mar 10, 2016 5:20 pm
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".
Re: Problem with calculation
Posted: Thu Mar 10, 2016 5:22 pm
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.
Re: Problem with calculation
Posted: Thu Mar 10, 2016 5:25 pm
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.
Re: Problem with calculation
Posted: Thu Mar 10, 2016 9:50 pm
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
Re: Problem with calculation
Posted: Fri Mar 11, 2016 10:48 am
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?
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:04 am
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.
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:09 am
by marac2203
Here is the order of dimensions in both cubes:
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:13 am
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
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:16 am
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.
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:33 am
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:
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:34 am
by marac2203
I also included all dimensions from referencing cube Tečaj in calculation.
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:46 am
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?
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:54 am
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.
Re: Problem with calculation
Posted: Fri Mar 11, 2016 11:55 am
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.
Re: Problem with calculation
Posted: Fri Mar 11, 2016 12:10 pm
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.