LastPeriods
EssbaseのMDX LastPeriods関数は、指定されたメンバーまたは時間ディメンションの現在のメンバーのいずれかで終わるメンバーのセットを返します。
構文
LastPeriods ( numeric value expression [, member [, hierarchy ] ] )パラメータ
例
Lastperiods(3, Apr)は、セット{Feb, Mar, Apr}を返します。
Lastperiods(-3, Apr)は、セット{Apr, May, Jun}を返します。
Lastperiods(1, Apr)は、1つのメンバーのセット{Apr}を返します。
Lastperiods(0, Apr)は空のセットを返します。
Lastperiods(5, Apr)はセット{Jan, Feb, Mar, Apr}を返します。出力セットには4つのメンバーしかないことに注意してください。
次の問合せ:
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例からの出力グリッド
| (軸) | Sales | Rolling Sales |
|---|---|---|
| Qtr2 | 27401 | 27014 |
| Apr | 8969 | 8960 |
| May | 9071 | 8997 |
| Jun | 9361 | 9133.667 |