Skip to main content

Selecting a Level Member by Relative Position

Selecting a Level Member by Relative Position

The following MDX functions enable you to select specific members of a level, relative to a given member. These functions all use the default order of members in the level. Note that the details are different for time dimensions and data dimensions (as defined in the cube definition):

  • NEXTMEMBER returns the next member from a given level. For example:

    SELECT MEASURES.[%COUNT] ON 0, birthd.[Q1 1920].NEXTMEMBER ON 1 FROM demomdx
    
                                        %COUNT
    Q2 1920                                   *
    
    
  • PREVMEMBER returns the previous member.

  • LEAD counts forward in the level and returns a later member. For example:

    SELECT MEASURES.[%COUNT] ON 0, birthd.[Q1 1920].LEAD(3) ON 1 FROM demomdx
    
                                        %COUNT
    Q4 1920                                   1
    
    
  • LAG counts backward in the level and returns an earlier member.

For time dimensions, each of these functions ignores any parent level. For example, the PREVMEMBER function can return a member that has a different parent. For data dimensions, however, each of these functions does consider the parent level. For example, the PREVMEMBER function considers only the previous member within the given parent member. (Note that the terms time dimension and data dimension refer specifically to the dimension type as defined in the cube. See Defining Models for InterSystems Business Intelligence.) For examples that show these differences, see the InterSystems MDX Reference.

FeedbackOpens in a new tab