问题
I have two almost similar MDX queries, in one I am using .CHILDREN and in other .ALLMEMBERS. First one returns no rows, the second one returns two. Please help me in understanding why!
Query 1
select
[Measures].[Claim As Of - Count] on 0,
[Accident Date].[Year].allmembers on 1
from [AW Cube]
where [Accident Date].[Year-Quarter-Month-Date].[Year].&[2010]
---2 rows
Query 2
select
[Measures].[Claim As Of - Count] on 0,
[Accident Date].[Year].children on 1
from [AW Cube]
where [Accident Date].[Year-Quarter-Month-Date].[Year].&[2010]
--NO rows
---- Claim As Of - Count --All 637,350 --2010 637,350
Just to add up, AccidentDate is one of the Dimensions in my Cube [AW Cube]. Year is a natural hierarchy while [Year-Quarter-Month-Date] is an user defined hierarchy. [Year-Quarter-Month-Date] is created in the below way: Year-->Month--->Quarter--->Date. So 'years' can be obtained by doing [Accident Date].[Year-Quarter-Month-Date].[Year].members and also [Accident Date].[Year].MEMBERS.
回答1:
Well, got the answer myself. Actually every .CHILDREN
gets internally translated to .CURRENTMEMBER.CHILDREN
Now, [Accident Date].[Year].&[2010]
is the corresponding value for the slicer on user defined hierarchy. Here, [Accident Date].[Year].CHILDREN
actually gets translated to [Accident Date].[Year].&[2010].CHILDREN
which is basically an empty set. Hence, Voila! The empty result set!
来源:https://stackoverflow.com/questions/25786590/difference-in-results-while-using-children-and-allmembers-in-an-mdx-statement