SSAS OLAP MDX and relationships
        Posted  
        
            by 
                Sonic Soul
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sonic Soul
        
        
        
        Published on 2011-06-24T00:03:00Z
        Indexed on 
            2011/06/24
            0:22 UTC
        
        
        Read the original article
        Hit count: 242
        
I new to OLAP, and still not sure how to create a relationship between 2 or more entities.
I am basing my cube on views. For simplicity sake let's call them like this:
viewParent (ParentID PK)
viewChild (ChildID PK, ParentID FK)
these views have more fields, but they're not important for this question.
in my data source, i defined a relationship between viewParent and viewChild using ParentID for the link.
As for measures, i was forced to create separate measures for Parent and Child.
in my MDX query however, the relationship does not seem to be enforced. If i select record count for parent, child, and add some filters for the parent, the child count is not reflecting it..
SELECT {
    [Measures].[ParentCount],[Measures].[ChildCount]
} ON COLUMNS
FROM [Cube]
WHERE {
    (
    {[Time].[Month].&[2011-06-01T00:00:00]}
    ,{[SomeDimension].&[Foo]}
    )
}
the selected ParentCount is correct, but ChildCount is not affected by any of the filters (because they are parent filters). However, since i defined a relationship, how can i take advantage of that to filter children by parent filter?
© Stack Overflow or respective owner