The default MDX script that Analysis Services creates when you define a cube contains a single CALCULATE statement. This single CALCULATE statement is at the beginning of the default MDX script, and indicates that the entire cube should be calculated during the first calculation pass.
The default MDX script also contains the script commands that create named sets, assignments, and calculated members created in Cube Designer:
Analysis Services directly adds script commands to the default MDX script.
For each named set in the cube, a corresponding CREATE SET statement exists in the default MDX script.
For each calculated member defined in the cube, a corresponding CREATE MEMBER statement exists in the default MDX script.
You can control the order of script commands, named sets, and calculated members in the default MDX script by using the Calculations tab of Cube Designer. For more information on defining calculations stored in the default MDX script, see Defining Calculations.
If there is no MDX script associated with a cube, the cube assumes the default MDX script. A cube needs to be associated with at least one MDX script because a cube relies on the MDX script to determine calculation behavior. In other words, a cube that was not associated with an MDX script or was associated with an empty MDX script could not and would not be able to calculate any cells. If you programmatically create cubes, either by using Analysis Services Scripting Language (ASSL) commands or by using Analysis Management Objects (AMO), it is recommended that you create a default MDX script containing a single CALCULATE statement for the cube.
Conditional statements add conditional logic to MDX scripts. This category includes the CASE and IF statements.
An assignment expression assigns an expression, such as a value, to a constrained subcube. A constrained subcube expression is a collection of constrained set expressions that define the "edges" of a subcube within an MDX script. The following codes shows the syntax for a constrained subcube expression: