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 )
or
Item ( tuple, index )
Syntax that Returns a Tuple—one of the following:
set[.Item] ( index )
or
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:
-
When returning a member, index is the 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.
-
When returning a tuple, index is the 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 1, Extracting a Member from a Tuple
The following query:
SELECT
{( [Qtr1], [Sales], [Cola], [Florida], [Actual] ).Item(3)}
ON COLUMNS
FROM Sample.Basic
returns the following output:
Table 4-100 Output Grid from MDX Example
Florida |
---|
5029 |
The following query:
SELECT
{Item(( [Qtr1], [Sales], [Cola], [Florida], [Actual] ), 2)}
ON COLUMNS
FROM Sample.Basic
returns the following output:
Table 4-101 Output Grid from MDX Example
Cola |
---|
22777 |
Example 2, Extracting a Tuple from a Set
The following query returns the first tuple in the set CrossJoin([Market].CHILDREN, [Product].CHILDREN)
, which is ([East], [Colas])
:
SELECT
{CrossJoin
(
[Market].CHILDREN,
[Product].CHILDREN
).ITEM(0)}
ON COLUMNS
FROM Sample.Basic
Because the ITEM keyword is optional, the above query can also be written as:
SELECT
{CrossJoin
(
[Market].CHILDREN,
[Product].CHILDREN
)(0)}
ON COLUMNS
FROM Sample.Basic
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 returns the first tuple of the crossjoined set, which is ([East],[100])
:
CrossJoin([Market].CHILDREN, [Product].CHILDREN).item(0)
The following example returns the second member of the first tuple of the crossjoined set, which is [100]
:
CrossJoin([Market].CHILDREN, [Product].CHILDREN).item(0).item(1)