移回同一层次结构中的 x 个成员 [英] Move back x members in same hierarchy
问题描述
是否有一个函数可以将指定层次结构级别中一定数量的成员移回?
Is there a function which moves back a set number of members in a specified hierarchy's level?
如果我想移回两个成员,将类似于以下内容:
It would be something like the following if I want to move back two members:
SOMEFUNCTION([someMember], [specifiedLevel],-2)
举个例子:
WITH MEMBER [Date].[Date - Calendar Month].[2MthPrev] AS
SOMEFUNCTION(
CLOSINGPERIOD([Date].[Date - Calendar Month].[Calendar Month]),
[Date].[Date - Calendar Month].[Calendar Month],
-2
)
推荐答案
您可以尝试几个不同的功能:
There are a few different functions that you could try out:
滞后:返回在成员级别的指定成员之前指定位置数的成员.
Lag: Returns the member that is a specified number of positions before a specified member at the member's level.
示例:这将返回 2001 年 12 月
Example: this will return December 2001
SELECT [Date].[Fiscal].[Month].[February 2002].Lag(2) ON 0
FROM [Adventure Works]
请参阅 http://technet.microsoft.com/en-us/library/ms144866.aspx 了解更多详情
See http://technet.microsoft.com/en-us/library/ms144866.aspx for more details
ParallelPeriod:返回与指定成员具有相同相对位置的上一期间的成员.
ParallelPeriod: Returns a member from a prior period in the same relative position as a specified member.
示例:
SELECT ParallelPeriod ([Date].[Calendar].[Calendar Quarter], 3,
[Date].[Calendar].[Month].[October 2003]) ON 0
FROM [Adventure Works]
请参阅 http://technet.microsoft.com/en-us/library/ms145500.aspx 了解更多详情
See http://technet.microsoft.com/en-us/library/ms145500.aspx for more details
(示例取自技术网站)
这篇关于移回同一层次结构中的 x 个成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!