最後一個期間
Essbase 的 MDX LastPeriods 函數會傳回一組在指定成員或 Time 維度中目前成員的結尾成員。
語法
LastPeriods ( numeric value expression [, member [, hierarchy ] ] )範例
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 的輸出方格範例
| (axis) | 銷售 | 累計銷售 |
|---|---|---|
| Qtr2 | 27401 | 27014 |
| 四月 | 8969 | 8960 |
| 5 月 | 9071 | 8997 |
| 6 月 | 9361 | 9133.667 |