曾经需要 CurrentMember.Item(0) [英] Ever a need for CurrentMember.Item(0)

查看:39
本文介绍了曾经需要 CurrentMember.Item(0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下自定义度量取自 MDX Cookbook (Tomislav Piasevoli) 一书:

The custom measure in the following is taken from the book MDX Cookbook (Tomislav Piasevoli):

WITH 
  MEMBER [Internet Sales PP] AS 
    Sum
    (
      Generate
      (
        {
            [Date].[Calendar].[Date].&[20080105]
          : 
            [Date].[Calendar].[Date].&[20080125]
        }
       ,{
          ParallelPeriod
          (
            [Date].[Calendar].[Calendar Year]
           ,1
           ,[Date].[Calendar].CurrentMember.Item(0)
          )
        }
      )
     ,[Measures].[Internet Sales Amount]
    ) 
SELECT 
  {
    [Measures].[Internet Sales Amount]
   ,[Internet Sales PP]
  } ON 0
 ,[Product].[Color].MEMBERS ON 1
FROM [Adventure Works];

item(0) 有什么用途?

我的理解,这可能是错误的

My understanding, which is probably wrong is

  • .item(0) 给了我们集合中的第一个元组
  • .item(0) 给了我们元组中的第一个成员
  • <set>.item(0) gives us first tuple in set
  • <tuple>.item(0) gives us first member in tuple

那么.item(0)有什么意义?

推荐答案

参考 这篇 关于这个主题的优秀文章.

Refer this excellent article on the topic.

总而言之,当我们对成员执行 .ITEM(0) 时,该成员被隐式转换为元组.所以,.ITEM(0) 除了返回成员本身之外并没有真正的作用.

To sum it up, when we are doing a .ITEM(0) on a member, that member is implicitly converted to a tuple. So, .ITEM(0) does not really serve any purpose other than returning the member itself.

这篇关于曾经需要 CurrentMember.Item(0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆