Identify in Rule if dim is part of a cube

Post Reply
bunchukokoy
Regular Participant
Posts: 197
Joined: Thu Dec 03, 2009 8:47 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2.x
Excel Version: 2010
Location: Singapore

Identify in Rule if dim is part of a cube

Post by bunchukokoy »

Guys,

Is it possible to identify via Rules if a dimension is part of a cube? :D

Thanks.

Art
declanr
MVP
Posts: 1816
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: Identify in Rule if dim is part of a cube

Post by declanr »

Presuming that you don't create cubes that often you could just create a 2d cube using }Dimensions and }cubes then have a 1 or 0 to determine if the dim exists in the cube.

You can even automate the population of 1s and 0s via TI using the tabdim function and a loop.
Declan Rodger
bunchukokoy
Regular Participant
Posts: 197
Joined: Thu Dec 03, 2009 8:47 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2.x
Excel Version: 2010
Location: Singapore

Re: Identify in Rule if dim is part of a cube

Post by bunchukokoy »

That's a solution. Just wondering because in my case, we already have plenty of cubes. If this is not possible thru' rules alone and without creating a look-up cube, then creating this 2d cube is the only solution.
lotsaram
MVP
Posts: 3667
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Identify in Rule if dim is part of a cube

Post by lotsaram »

The function you want is TABDIM. If it returns 0 then the dimension is not part of the cube.

When building a helper cube for this type of lookup I believe it is best to have a replica of the }dimensions and }cubes dims with an ALL rollup. That way analysis of dimensions not used by any cubes also becomes very easy.
bunchukokoy
Regular Participant
Posts: 197
Joined: Thu Dec 03, 2009 8:47 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2.x
Excel Version: 2010
Location: Singapore

Re: Identify in Rule if dim is part of a cube

Post by bunchukokoy »

Many thanks for the help. :D
User avatar
FallenCipher
Posts: 8
Joined: Mon Aug 13, 2012 8:17 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2
Excel Version: 2013
Location: Germany

Re: Identify in Rule if dim is part of a cube

Post by FallenCipher »

lotsaram wrote:The function you want is TABDIM. If it returns 0 then the dimension is not part of the cube.
TABDIM only gives you the dimension name for the specified index. TABDIM doesn't accept a dimension name as a parameter.
A small helper cube would be the best solution in my opinion.
"Who's the more foolish? The fool, or the fool who follows him?"
- Obi-Wan Kenobi, Star Wars Episode IV
declanr
MVP
Posts: 1816
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: Identify in Rule if dim is part of a cube

Post by declanr »

FallenCipher wrote:
lotsaram wrote:The function you want is TABDIM. If it returns 0 then the dimension is not part of the cube.
TABDIM only gives you the dimension name for the specified index. TABDIM doesn't accept a dimension name as a parameter.
A small helper cube would be the best solution in my opinion.
Which can purely be built via a scheduled TI and a pretty damn simple TI at that so all in all its not at all difficult to do...

But why do you need to know whether a Dim is part of a Cube in a rule statement?
Declan Rodger
bunchukokoy
Regular Participant
Posts: 197
Joined: Thu Dec 03, 2009 8:47 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2.x
Excel Version: 2010
Location: Singapore

Re: Identify in Rule if dim is part of a cube

Post by bunchukokoy »

It just became a requirement to identify if certain dims are part of certain cubes. And I wanted to make it general and simpler via rules.
But then, based on comments, it's the only solution which is as you said very simple to do.

Thanks. :D
declanr
MVP
Posts: 1816
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: Identify in Rule if dim is part of a cube

Post by declanr »

bunchukokoy wrote:It just became a requirement to identify if certain dims are part of certain cubes. And I wanted to make it general and simpler via rules.
But then, based on comments, it's the only solution which is as you said very simple to do.

Thanks. :D

From what I recall there was a TI knocking about (possibly on Bedrock) that exported a csv telling you which dimensions weren't in any cubes... a little tweak to that may give you what you need.
Declan Rodger
lotsaram
MVP
Posts: 3667
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Identify in Rule if dim is part of a cube

Post by lotsaram »

FallenCipher wrote:
lotsaram wrote:The function you want is TABDIM. If it returns 0 then the dimension is not part of the cube.
TABDIM only gives you the dimension name for the specified index. TABDIM doesn't accept a dimension name as a parameter.
A small helper cube would be the best solution in my opinion.
Sorry what I meant was returns blank if the dimension is not part of the cube, not 0.
I don't know what your fuss is about. This is very easy to do:
For example a 4 dim cube called Dim_Use; zCubes, zDimensions, DimIndex, Dim_Use_M (where zCubes and zDimensions are replicas of the control dims but with an ALL rollup). The "index" dimension just has elements 1,2,3 .... to a sensible max equal to ro greater then the maximum number of dimensions in any cube in the model. The measure dimension need only have one numeric element "position" or "index" (but you can easily add a 2nd numeric or string element "used in cube" with a 1/0 or true/false value if the value of position is non-zero)

Code: Select all

['Dim_Use_M':'Position'] = N:
IF( TABDIM(!zCubes, NUMBR(!DimIndex)) @= !zDimensions,
   NUMBR(!DimIndex),
   0
);
If for a selected cube the position value is >0 then the dimension is used in the cube.
If for "ALL Cubes" the position value is 0 then the dimension is not used in any cubes.
Simple.
bunchukokoy
Regular Participant
Posts: 197
Joined: Thu Dec 03, 2009 8:47 am
OLAP Product: IBM Cognos TM1
Version: 10.2.2.x
Excel Version: 2010
Location: Singapore

Re: Identify in Rule if dim is part of a cube

Post by bunchukokoy »

Thanks for the help guys. :D
Post Reply