Dimension Member作为MDX中的度量

时间:2014-02-22 04:56:06

标签: mdx

我需要将维度成员作为度量返回。

假设:

尺寸

[Customer].[customer name] members {ACME, EMCA, EMC}    

[Salesperson].[person name] members {Bob, Fred, Mary, Joe} with the property "name"

措施 值

关系

The Customer is a dimension of the facts that contain Value
The Salesperson is a dimensions of the facts that contain Value, each customer has one salesperson associated 

我正在尝试执行以下操作:

创建将在客户的列中返回销售人员姓名的度量。 e.g。

| Customer          |Sales person | Value |
| ACME              | Bob         | 500   |
| EMCA              | Bob         | 540   |
| EMC               | Mary        | 840   |

我试过这样的话:

使用会员[度量]。[sp_name]作为[销售员]。[人名] .currentmember.properties(“名称”)

选择 {[measure]。[sp_name],[measure]。[value]} on 0 {[customer]。[customer name] .members} on 1 从

但它始终返回错误“属性名称对[销售员]无效。[所有销售人员]” 如果我使用With Member [measure].[sp_name] as [Salesperson].[person name].currentmember.firstindex.properties("name") 我为所有客户找到了一个人,这显然是不对的。我错过了什么吗?

2 个答案:

答案 0 :(得分:0)

我想说在Analysis Services 2008中,这应该在您实现它时起作用,为null成员返回All。如果您使用的环境更敏感,那么也许您可以使用类似

的内容
With Member [measure].[sp_name] as
     IIF([Salesperson].[person name].currentmember IS [Salesperson].[all salesperson],
         'All',
         [Salesperson].[person name].properties("name")
        )
Select {[measure].[sp_name], [measures].[value]} on 0,
       {[customer].[customer name].members} on 1
  from [MyCube]

答案 1 :(得分:0)

[Salesperson].[person name].CurrentMember.Member_Name