Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Limits the scope of specified Multidimensional Expressions (MDX) statements to a specified subcube.

The SCOPE statement determines the subcube that will be affected by the running of one or more MDX statements. Unless an MDX statement is framed within a SCOPE statement, the implicit scope of an MDX statement is the entire cube.

Note

Hidden members are exposed in SCOPE statements.

SCOPE statements will create subcubes that expose "holes" regardless of the MDX Compatibility setting. For example, the statement, Scope( Customer.State.members ), can include the states in countries or regions that do not contain states, but for which otherwise invisible placeholder members were inserted.

Calculated members and named sets created within a SCOPE statement are unaffected by the SCOPE statement.

Example

The following example, from the MDX calculation script in the Adventure Works sample solution, defines the current scope as fiscal quarter in fiscal year 2005 and the sales amount quota measure, and then assigns a value to the cells in the current scope by using the ParallelPeriod function. The example then modifies the scope using another SCOPE statement, and then performs another assignment using the
This (MDX) function.