最后期间

Essbase 的 MDX LastPeriods 函数返回以指定成员或“时间”维中的当前成员结尾的成员集。

语法

LastPeriods ( numeric value expression [, member [, hierarchy ] ] )

参数

数值表达式

要返回的成员数(请参见 MDX Grammar Rules )。如果为负,则将 member 视为起点。

成员

可选。成员表达式。

层次结构

可选。时间维中的特定层次结构。

示例

Lastperiods(3, Apr) 返回集 {Feb, Mar, Apr}。

Lastperiods(-3, Apr) 返回集 {Apr, May, Jun}。

Lastperiods(1, Apr) 返回一组成员:{Apr}。

Lastperiods(0, Apr) 返回空集。

Lastperiods(5, Apr) 返回集 {Jan, Feb, Mar, Apr}。请注意,输出集只有四个成员。

下面的查询:

WITH MEMBER
 [Measures].[Rolling Sales] AS 
'Avg  (
 LastPeriods 
    (3, [Year].Currentmember
    ), 
 [Measures].[Sales]
 )'
SELECT
 {[Measures].[Sales], [Measures].[Rolling Sales]}
ON COLUMNS, 
 Descendants ([Year].[Qtr2])
ON ROWS
FROM Sample.Basic
WHERE [Product].[Root Beer]

返回网格:

表 4-104 MDX 中的输出网格示例

(轴) 销售 滚动销售
Qtr2 27401 27014
4 月 8969 8960
5 月 9071 8997
6 月 9361 9133.667