tags:

views:

91

answers:

1

I'm currently struggling with the creation of a cube.

Below is a simplified version of my relational data...

Race

Id  Type  Total 
1   A     3 
2   A     2

Result

Id  RaceId  Gender  Position
1   1       M       2
2   1       M       3
3   1       F       1
4   2       F       2
5   2       F       1

In some kind of pusedo language I would like to be able to run this query:

SELECT Sum(Total), Sum(Position) WHERE RaceType = A AND Gender = M

And I would expect to get the results: 3, 5

I have tried a couple of different configurations of dimensions and measures but always end up with the answer 5, 5.

I'm sure this is possible to achieve with the cube, I just don't currently have the knowledge to figure it out - any help would be appreciated.

Thanks

A: 

Not currently being able to see the dimensions/measures present in your cube, it would be roughly

SELECT
{
   [Measures].[Total],
   [Measures].[Position]
}
ON 0
FROM [YourCube]
WHERE(
  [Race].[RaceType].[A],
  [Result].[Gender].[M]
)

This is assuming you've chosen the default aggregation for your measures, which is SUM.

Jamiec
Thanks, that makes sense. I don't have access to my cube at the minute to try this so I'll ask instead... if I were to change Race 2 to type B and Result 4 to have a Gender of M would this still return the same results - it's this that I have struggled with.
Big Fat Noodle
@Big Fat Noodle - I dont think so, as result 4 would be Gender M but not RaceType A. The criteria in the WHERE for MDX can be roughly thought of as an AND operation.
Jamiec
OK, so is this because of the way that the dimensions and/or underlying data is structured, or is it just not possible to solve?
Big Fat Noodle
And thanks for the comments - they're really helpful.
Big Fat Noodle