Item

The MDX Item function for Essbase extracts a member from a tuple, or a tuple from a set.

Syntax

Syntax that Returns a Member—one of the following:

tuple[.Item] ( index )
Item ( tuple, index )

Syntax that Returns a Tuple—one of the following:

set[.Item] ( index )
Item ( set, index )

Parameters

tuple

The tuple from which to get a member.

index

The usage depends upon whether you are returning a member or a tuple:

  • Returning a member: Numeric position (starting from 0) of the member to extract from the tuple. A valid value for index is from 0 to 1 less than the size of the input tuple. A value of less than 0, or greater than or equal to size of the input tuple, results in an empty member.

  • Returning a tuple: Numeric position (starting from 0) of the tuple to extract from the set. A valid value for index is from 0 to 1 less than the size of the input set. A value of less than 0, or greater than or equal to size of the input set, results in an empty tuple.

set

The set from which to get a tuple.

Example

Example 1, Extracting a Member from a Tuple

SELECT
{( [Qtr1], [Sales], [Cola], [Florida], [Actual] ).Item(3)}
ON COLUMNS 
FROM Sample.Basic

returns:

Table 4-100 Output Grid from MDX Example

Florida
5029
SELECT
 {Item(( [Qtr1], [Sales], [Cola], [Florida], [Actual] ), 2)}
ON COLUMNS 
FROM Sample.Basic

returns:

Table 4-101 Output Grid from MDX Example

Cola
22777

Example 2, Extracting a Tuple from a Set

The following query

SELECT
{CrossJoin
 (
  [Market].CHILDREN, 
  [Product].CHILDREN
 ).ITEM(0)}
 ON COLUMNS
 FROM Sample.Basic

returns the first tuple in the set CrossJoin([Market].CHILDREN, [Product].CHILDREN), which is ([East], [Colas]):

The above query can also be written as:

SELECT
{CrossJoin
 (
  [Market].CHILDREN, 
  [Product].CHILDREN
 )(0)}
 ON COLUMNS
 FROM Sample.Basic

because the ITEM keyword is optional.

Example 3, Extracting Member from a Set

Consider the following crossjoined set of Market and Product members:

{
([East],[100]),([East],[200]),([East],[300]),([East],[400]),([East],[Diet]),
([West],[100]),([West],[200]),([West],[300]),([West],[400]),([West],[Diet]),
([South],[100]),([South],[200]),([South],[300]),([South],[400]),([South],[Diet]),
([Central],[100]),([Central],[200]),([Central],[300]),([Central],[400]),([Central],[Diet])
}

The following example

CrossJoin([Market].CHILDREN, [Product].CHILDREN).item(0)

returns the first tuple of the crossjoined set, ([East],[100]), and the following example

CrossJoin([Market].CHILDREN, [Product].CHILDREN).item(0).item(1)

returns [100], the second member of the first tuple of the crossjoined set.