Page 1 of 1

Identify in Rule if dim is part of a cube

Posted: Tue Aug 14, 2012 8:00 am
by bunchukokoy
Guys,

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

Thanks.

Art

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

Posted: Tue Aug 14, 2012 8:10 am
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.

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

Posted: Tue Aug 14, 2012 8:13 am
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.

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

Posted: Tue Aug 14, 2012 8:29 am
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.

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

Posted: Tue Aug 14, 2012 8:32 am
by bunchukokoy
Many thanks for the help. :D

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

Posted: Tue Aug 14, 2012 8:33 am
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.

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

Posted: Tue Aug 14, 2012 8:42 am
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?

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

Posted: Tue Aug 14, 2012 8:50 am
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

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

Posted: Tue Aug 14, 2012 9:00 am
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.

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

Posted: Tue Aug 14, 2012 9:19 am
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.

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

Posted: Wed Aug 15, 2012 9:58 am
by bunchukokoy
Thanks for the help guys. :D