Monday, March 26, 2012

Having Clause in MDX

I have the following relationships,

DimTest > FactTestScores <- DimStudents

so if I have 5 tests, A, B, C, D, E

how do I write an MDX statement to get all students who have taken all 3 tests (not just one of the 3) A,B,C ?

pseudocode: something like this would work?

SELECT {} on 0, DimStudents.Members on 1

FROM CUBE

WHERE (A,B,C)

can I use HAVING CLAUSE anywhere to make this work?

http://www.biblogs.com/2006/01/26/the-having-clause/

thanks

Assuming that there is a "count" measure on FactTestScores like [TestCount]:

With Set [SelectedTests] as {A, B, C}

select {} on 0,

DimStudent.Student.Student.Members

Having Count(NonEmpty([SelectedTests],

{[Measures].[TestCount]})

= Count([SelectedTests] ) on 1

from CUBE

|||

thank you Deepak

Please remind me one of these days how I can get you a gift to thank you for all your help.

No comments:

Post a Comment