Lead
Using the order of members in an Essbase outline, the MDX Lead() function returns a member that is n steps past a given member, along the same generation or level.
Syntax
member.Lead (index [,layertype ] [, hierarchy ])
or
Lead ( member, index [, hierarchy ] )
Parameters
Notes
-
If the member specified by the Lead function does not exist, the result is an empty member. For example, using Sample Basic,
[Jun].lead (12)
returns an empty member. -
When multiple hierarchies are enabled, this function returns NULL when the source member is in one hierarchy and the result member belongs to a different hierarchy.
Examples
The following expression returns [Dec]
, which is 11 steps past Jan:
[Jan].lead (11)
The following expression returns [Jan]
, which is 11 steps prior to Dec:
[Dec].lead (-11)
For every month, the following query displays the marketing expenses and budgeted sales for the next month:
WITH MEMBER
[Measures].[Expected Sales in Next month]
AS
'([Measures].[Sales], [Year].CurrentMember.Lead(1))'
SELECT
{
([Scenario].[Actual], [Measures].[Marketing]),
([Scenario].[Budget], [Measures].[Expected Sales in Next month])
}
ON COLUMNS,
[Year].Levels(0).Members
ON ROWS
FROM Sample.Basic
The above query returns the following output:
Table 4-105 Output Grid from MDX Example
(axis) | Actual | Budget |
---|---|---|
(axis) | Marketing | Expected Sales in Next Month |
Jan | 5223 | 30000 |
Feb | 5289 | 30200 |
Mar | 5327 | 30830 |
Apr | 5421 | 31510 |
May | 5530 | 32900 |
Jun | 5765 | 33870 |
Jul | 5985 | 33820 |
Aug | 6046 | 31000 |
Sep | 5491 | 29110 |
Oct | 5388 | 29540 |
Nov | 5263 | 30820 |
Dec | 5509 | #Missing |