tags:

views:

64

answers:

2

I have the following star schema:

Objects       <-> Facts         <-> Simulation
-ObjectID         -ObjectID         -SimulationID
-SimulationID     -SimulationID     
-ObjHierarchy     -Volume
-ObjectType

Now I'm trying to filter the cube using both dimensions:

select [Measures].[Volume] on columns,
[Objects].[ObjHierarchy].[Level 02] on rows
from [DM OC]
where ([Objects].[ObjectType].&[2], [Simulation].[SimulationID].&[52])

However, this returns rows for SimulationID=52 (with values) but also duplicates for SimulationID=53 (with nulls):

ObjHierarchy | Volume
MyObj1       | 12345
MyObj2       | 54321
MyObj1       | (NULL)
MyObj2       | (NULL)

A workaround is to use NonEmpty, however it just seems the cube isn't modeled the right way.

+1  A: 

It is a usual case and doesn't mean that the cube's model wrong.

In MDX, you should also filter the rows by using any filter function if you don't want them to appear in your result. In your case, you should use NonEmtpy to eleminate the empty values.

orka
A: 

Can you execute the following :

with member XX as [Objects].[ObjHierarchy].currentMember.Properties( "KEY" )

select { [Measures].[Volume], XX } on columns, [Objects].[ObjHierarchy].[Level 02] on rows from [DM OC] where ([Objects].[ObjectType].&[2], [Simulation].[SimulationID].&[52])

MyObj1 and MyObj2 should not have the same key; otherwise I do not see right now.

Marc Polizzi
That query returns the same number of results, with the "xx" member returning values for all rows (even for those where Volume is null). All objects in have different keys, so even the first MyObj1 has a different key than the second MyObj1 (the same applies for MyObj2) - for each SimulationID there is a different collection of Objects.
noup
It seems you have different MDX members with the same name so this explains the result.
Marc Polizzi