Using the order of members existing in a database outline, returns a member that is n steps behind a given member, along the same generation or level (as defined by layertype).
member.Lag (index [,layertype ] )
OR
Lag ( member, index )
| member | The starting member from which .LAG counts to a given number of previous members. |
| index | A number n representing how many steps prior to <member> to count. |
| layertype |
GENERATION or LEVEL. Generation is the default.
|
If the member specified by the Lag function does not exist, the result is an empty member. For example,
using Sample Basic, [Jun].lag (12) returns an empty member.
The following expression:
[Jun].lag (3)
returns the member that is 3 steps prior to Jun:
[Mar]
The following expression:
[Jun].lag (-3)
returns the member that is 3 steps following Jun:
[Sep]
For every month, the following query displays the sales and average over the last three months.
WITH MEMBER
[Measures].[Average Sales in Last 3 months]
AS
'Avg(
{[Year].CurrentMember,
[Year].CurrentMember.Lag(1),
[Year]. CurrentMember.Lag(2)
},
[Measures].[Sales]
)'
SELECT
{[Measures].[Sales],
[Measures].[Average Sales in Last 3 months]
}
ON COLUMNS,
[Year].Levels(0).Members
ON ROWS
FROM Sample.Basic
This query returns the grid:
| Sales | Average Sales in Last 3 Months | |
|---|---|---|
| Jan | 31538 | 31538 |
| Feb | 23069 | 31803.500 |
| March | 32213 | 31940 |
| April | 32917 | 32399.667 |
| May | 33674 | 32934.667 |
| Jun | 35088 | 33893 |
| Jul | 36134 | 34965.333 |
| Aug | 36008 | 35743.333 |
| Sep | 33073 | 35071.667 |
| Oct | 32828 | 33969.667 |
| Nov | 31971 | 32624 |
| Dec | 33342 | 32713.667 |
Lead, which is the reverse of Lag.
Prevmember, which is the same as Lag(1).
| ©2004 Hyperion Solutions Corporation. All Rights Reserved. http://www.hyperion.com |