获取层次结构valuesName mdx

时间:2015-07-16 08:42:02

标签: mdx

我创建了如下图所示的层次结构:

http://i.stack.imgur.com/ErOXQ.png

在MDX查询

Select [AccSetting].[UserN].[UserN] ON 1
FROM [Olap_report]
Where [AccSetting].[AgID].[115]

此查询返回UserN的所有AgID 115个孩子。但我想准确回复UserN的{​​{1}}?

1 个答案:

答案 0 :(得分:0)

我想我现在明白了 - 名字是会员的财产。

创建一个返回属性的自定义度量。

WITH 
  MEMBER [Measures].[NameColumn] AS
    [AccSetting].[AgID].CURRENTMEMBER.Member_Name
  MEMBER [Measures].[NameColumn2] AS
    [AccSetting].[AgID].CURRENTMEMBER.Name
SELECT
  {
   [Measures].[NameColumn]
  ,[Measures].[NameColumn2]
  } ON 0,
  [AccSetting].[AgID].[115] ON 1
FROM [Olap_report]

msdn的参考: https://msdn.microsoft.com/en-us/library/ms145583.aspx

修改

首先检查成员是否存在:

SELECT
  {
    [Measures].[<add measure here>],
    [Measures].[<add measure here>]
  } ON 0,
  {
   [AccSetting].[AgID].[115],
   [AccSetting].[AgID].[113]
  } ON 1
FROM [Olap_report]