dimix use

Post Reply
Moh
Posts: 43
Joined: Fri Aug 01, 2014 5:17 pm
OLAP Product: Cognos
Version: 10.1.1
Excel Version: 2010

dimix use

Post by Moh »

Hello Sir,I am confused about dimix.The reference guide says if( dimix(dimensionname,elementname)=1) means in TI if element exists and the rules guide says in chap10 ---> IF(DIMIX(’Date’, !Date)=1) means This rules say "if the current date is the first date in the Date dimension, thenQuantity in Stock - Kgs is 0; otherwise Quantity in Stock - Kgs is equal toyesterday's Remaining value from the Depletion cube for the immediatelyprevious DaysOld batch.Is there different usage for dimix in rules and TI and what is the difference.thanks for clarifying my doubt.The complete rules example----> [’Quantity in Stock - Kgs’]= N: IF(DIMIX(’Date’, !Date)=1,
0, DB(’Depletion’,!FishType,DIMNM(’Date’, DIMIX(’Date’, !Date)-1),
DIMNM(’DaysOld’,DIMIX(’DaysOld’, !DaysOld) -1),’Remaining’));
User avatar
Martin Ryan
Site Admin
Posts: 1981
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: dimix use

Post by Martin Ryan »

I can see two possible angles to your question so hopefully one of the two answers is what you're after.

DIMIX of zero means that an element is not in the dimension. E.g. dimix('DaysOfTheWeek', 'Tomato'); is likely to return zero because 'Tomato' isn't an element in the DaysOfTheWeek dimension. So the typical use of this is

Code: Select all

if(dimix('MyDim', Elem)<>0); do something; endif;
or

Code: Select all

if(dimix('MyDim', Elem)=0); do something else; endif;
However from the second half of your question I think you're talking about finding out what the next element in the dimension is.

Code: Select all

['Tomorrows']=dbrw('Cube', dimnm('Day', dimix('Day', !Day)+1), !FishType);
Likewise this returns the previous element in the dimension.

Code: Select all

['Yesterdays']=dbrw('Cube', dimnm('Day', dimix('Day', !Day)-1), !FishType);
Personally I'm not a fan of this approach because it means two function calls, and if your dimension in not in the order you think it is, then you'll get unpredictable numbers. I prefer setting up "Next" and "Prev" attributes, then using them like so

Code: Select all

['Tomorrows']=dbrw('Cube', attrs('Day', !Day, 'Next'), !FishType);
['Yesterdays']=dbrw('Cube', attrs('Day', !Day, 'Prev'), !FishType);
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Moh
Posts: 43
Joined: Fri Aug 01, 2014 5:17 pm
OLAP Product: Cognos
Version: 10.1.1
Excel Version: 2010

Re: dimix use

Post by Moh »

Thank you.if(dimix('MyDim', Elem)=0) returns 0 or 1 depending on element exists in the dimension.in the rule it says---->IF(DIMIX(’Date’, !Date)=1) means This rules say "if the current date is the first date in the Date dimension,here value of 1 is assigned if the current date is the first date in the Date dimension.this usage confusing me.once again,thanks for clarifying my doubt.
declanr
MVP
Posts: 1800
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: dimix use

Post by declanr »

Moh wrote:Thank you.if(dimix('MyDim', Elem)=0) returns 0 or 1 depending on element exists in the dimension.in the rule it says---->IF(DIMIX(’Date’, !Date)=1) means This rules say "if the current date is the first date in the Date dimension,here value of 1 is assigned if the current date is the first date in the Date dimension.this usage confusing me.once again,thanks for clarifying my doubt.
Dimix is not a boolean yes/no function as to whether an element exists or not; a 0 response does indeed indicate the the element specified does not exist in the dimension - but if the element does exist it will return the index of the element within the dimension (i.e. 1 if the element is the first in the dimension or 999999 if it is the 999999th element in the dimension.)
Declan Rodger
Moh
Posts: 43
Joined: Fri Aug 01, 2014 5:17 pm
OLAP Product: Cognos
Version: 10.1.1
Excel Version: 2010

Re: dimix use

Post by Moh »

thank you all.
Post Reply