Difference in results while using .CHILDREN and .ALLMEMBERS in an MDX statement

匆匆过客 提交于 2019-12-11 03:35:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!