Lead
Using the order of members existing in an Essbase database outline, the MDX Lead function returns a member that is n steps past a given member, along the same generation or level (as defined by layertype).
Syntax
member.Lead (index [,layertype ] [, hierarchy ])
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.
Example
The following expression:
[Jan].lead (11)
returns the member that is 11 steps past Jan:
[Dec]
The following expression:
[Dec].lead (-11)
returns the member that is 11 steps prior to Dec:
[Jan]
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
This query returns the grid:
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 |