--- title: "EXISTING Keyword (MDX) | Microsoft Docs" ms.custom: "" ms.date: "03/06/2017" ms.prod: "sql-server-2016" ms.reviewer: "" ms.suite: "" ms.technology: - "analysis-services" - "analysis-services/multidimensional-tabular" - "analysis-services/data-mining" ms.tgt_pltfrm: "" ms.topic: "article" f1_keywords: - "EXISTING" helpviewer_keywords: - "Existing keyword" ms.assetid: 651ee9ac-04ef-4316-87c9-a3df5ac27d22 caps.latest.revision: 38 author: "Minewiskan" ms.author: "owend" manager: "erikre" --- # MDX Query - EXISTING Keyword Forces a specified set to be evaluated within the current context. ## Syntax ``` Existing Set_Expression ``` ## Arguments *Set_Expression* A valid Multidimensional Expressions (MDX) set expression. ## Remarks By default, sets are evaluated within the context of the cube that contains the members of the set. The **Existing** keyword forces a specified set to be evaluated within the current context instead. ## Example The following example returns the count of the resellers whose sales have declined over the previous time period, based on user-selected State-Province member values evaluated using the **Aggregate** function. The [Hierarchize (MDX)](../../../mdx/hierarchize-mdx.md) and [DrilldownLevel (MDX)](../../../mdx/drilldownlevel-mdx.md) functions are used to return values for declining sales for product categories in the Product dimension. The **Existing** keyword forces the the set in the **Filter** function to be evaluated in the current context - that is, for the Washington and Oregon members of the State-Province attribute hierarchy. ``` WITH MEMBER Measures.[Declining Reseller Sales] AS Count (Filter (Existing (Reseller.Reseller.Reseller) , [Measures].[Reseller Sales Amount] < ([Measures].[Reseller Sales Amount] ,[Date].Calendar.PrevMember ) ) ) MEMBER [Geography].[State-Province].x AS Aggregate ( {[Geography].[State-Province].&[WA]&[US] , [Geography].[State-Province].&[OR]&[US] } ) SELECT NON EMPTY HIERARCHIZE (AddCalculatedMembers ( {DrillDownLevel ({[Product].[All Products]} ) } ) ) DIMENSION PROPERTIES PARENT_UNIQUE_NAME ON COLUMNS FROM [Adventure Works] WHERE ( [Geography].[State-Province].x , [Date].[Calendar].[Calendar Quarter].&[2003]&[4] ,[Measures].[Declining Reseller Sales] ) ``` ## See Also [Count (Set) (MDX)](../../../mdx/count-set-mdx.md) [AddCalculatedMembers (MDX)](../../../mdx/addcalculatedmembers-mdx.md) [Aggregate (MDX)](../../../mdx/aggregate-mdx.md) [Filter (MDX)](../../../mdx/filter-mdx.md) [Properties (MDX)](../../../mdx/properties-mdx.md) [DrilldownLevel (MDX)](../../../mdx/drilldownlevel-mdx.md) [Hierarchize (MDX)](../../../mdx/hierarchize-mdx.md) [MDX Function Reference (MDX)](../../../mdx/mdx-function-reference-mdx.md)