Compartilhar via


NonEmpty (MDX)

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.

Syntax

NONEMPTY(set_expression1 [,set_expression2])

Arguments

  • set_expression1
    A valid Multidimensional Expressions (MDX) expression that returns a set.
  • set_expression2
    A valid Multidimensional Expressions (MDX) expression that returns a set.

Remarks

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]

See Also

Reference

MDX Function Reference (MDX)
DefaultMember (MDX)
NonEmptyCrossjoin (MDX)
IsEmpty (MDX)
Filter (MDX)

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

17 July 2006

Changed content:
  • Updated syntax and arguments to improve clarity.
  • Added updated examples.