Exists (MDX) Home
SQL Server 2008 Books Online (October 2009)
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 that have associated rows in the fact table of 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 when the MeasureGroupName argument is specified.

Examples

Customers who live in California:

SELECT [Measures].[Internet Sales Amount] ON 0,
EXISTS(
[Customer].[Customer].[Customer].MEMBERS
, {[Customer].[State-Province].&[CA]&[US]}
) ON 1 
FROM [Adventure Works]

Customers who live in California with sales:

SELECT [Measures].[Internet Sales Amount] ON 0,
EXISTS(
[Customer].[Customer].[Customer].MEMBERS
, {[Customer].[State-Province].&[CA]&[US]}
, "Internet Sales") ON 1 
FROM [Adventure Works]

Customers with sales:

SELECT [Measures].[Internet Sales Amount] ON 0,
EXISTS(
[Customer].[Customer].[Customer].MEMBERS
, , "Internet Sales") ON 1 
FROM [Adventure Works]

Customers whom bought Bikes:

SELECT [Measures].[Internet Sales Amount] ON 0,
EXISTS(
[Customer].[Customer].[Customer].MEMBERS
, {[Product].[Product Categories].[Category].&[1]}
, "Internet Sales") ON 1 
FROM [Adventure Works]
See Also

Reference

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

Help and Information

Getting SQL Server 2008 Assistance
© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View