NonEmpty (MDX)
SQL Server 2005
Updated:
17 July 2006
Returns the set of tuples that are not empty from a specified set, based on the cross product of the specified set with a second set.
This function returns the tuples in the first specified set that are non-empty when evaluated across the tuples in the second set. The NonEmpty function takes into account calculations and preserves duplicate tuples. If a second set is not provided, the expression is evaluated in the context of the current coordinates of the members of the attribute hierarchies and the measures in the cube.
Note: |
|---|
| Use this function rather than the deprecated NonEmptyCrossjoin (MDX)function. |
Important: |
|---|
| Non-empty is a characteristic of the cells references by the tuples, not the tuples themselves. |
Example
The following example returns the set of tuples containing customers and purchase dates, using the Filter function and the NonEmpty functions to find the last date that each customer made a purchase.
WITH SET MYROWS AS FILTER
(NONEMPTY
([Customer].[Customer Geography].[Customer].MEMBERS
* [Date].[Date].[Date].MEMBERS
, [Measures].[Internet Sales Amount]
) AS MYSET
, NOT(MYSET.CURRENT.ITEM(0)
IS MYSET.ITEM(RANK(MYSET.CURRENT, MYSET)).ITEM(0))
)
SELECT [Measures].[Internet Sales Amount] ON 0,
MYROWS ON 1
FROM [Adventure Works]
Note: