Compartilhar via


Exists (MDX)

Returns the set of tuples of the first set specified that exist with one or more tuples of the second set specified. This function performs manually what auto exists performs automatically. For more information about auto exists, see Key Concepts in MDX (MDX).

If the optional <Measure Group Name> is provided, the function returns tuples that exist with one or more tuples from the second set and those tuples have non NULL data in the specified measure group.

Syntax

Exists( Set_Expression1 , Set_Expression2 [, MeasureGroupName] )

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.
  • MeasureGroupName
    A valid string expression specifying a measure group name.

Remarks

Measure group rows with measures containing null values contribute to Exists.

Examples

Customers who live in California:

Exists(Customers.byName.members, {Customers.State.CA})

Customers who live in California with sales:

Exists(Customers.byName.members, {Customers.State.CA}, 'Sales')

Customers with sales:

Exists(Customers.byName.members, , 'Sales')

Customers with Xbox sales:

Exists(Customers.byName.members, {Product.[Product Name].[Xbox]} , 'Sales')

Customers with sales in the states of Washington, California, or England (where the value for England is improperly placed within the United States):

SELECT 
 Exists(
   [Customer].[Customer Geography].[State-Province].Members * 
    [Sales Channel].[Sales Channel].&[Internet]
   ,
   {[Customer].[Customer Geography].[State-Province].&[WA]&[US], 
    [Customer].[Customer Geography].[State-Province].&[CA]&[US],
    [Customer].[Customer Geography].[State-Province].&[ENG]&[US]}
  )
ON 0
FROM [Adventure Works]
WHERE [Measures].[Internet Sales Amount]

See Also

Reference

MDX Function Reference (MDX)
Crossjoin (MDX)
NonEmptyCrossjoin (MDX)
NonEmpty (MDX)
IsEmpty (MDX)

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

12 December 2006

Changed content:
  • Added another example.

17 July 2006

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