Database Reference
In-Depth Information
Listing 14-4. Examples in MDX with Optional Syntax Items
Select
{ [Measures].[SalesQuantity] } On Columns,
{ [DimTitles].[Title].[Is Anger the Enemy?] } On Rows
From [ CubePubsSales ]
Where ( [DimStores].[Store].[Eric the Read Books] );
-- The same code with optional syntax items removed
Select
Measures.SalesQuantity On Columns,
-- Curly Braces {} are optional: Defines a Set of Results
DimTitles.Title.[Is Anger the Enemy?] On Rows
-- Square Brackets [] are optional: Defines an Object Identifier
From CubePubsSales
-- Parentheses () are optional: Defines Function Parameters or Set of Coordinates
Where DimStores.Store.[Eric the Read Books];
-- Semi-colons; are optional: Defines the End of a Statement
Additionally, as in SQL, there is an optional WHERE clause. MDX code is not case-sensitive, and it isn't
sensitive to white spaces within your code. Listing 14-5 gives three examples that highlight this point.
Listing 14-5. Three More Syntax Examples in MDX
-- The Where clause is also optional
Select
[Measures].[SalesQuantity] On Columns,
[DimTitles].[Title].[Is Anger the Enemy?] On Rows
From [CubePubsSales]
-- MDX is not sensitive to white spaces
Select [Measures].[SalesQuantity]
On Columns ,
[DimTitles]. [Title].
[Is Anger the Enemy?]
On Rows
From [CubePubsSales]
-- MDX is not Case Sensitive
SelECt
[MeaSURes].[SALESQUANTITY] On CoLUMns,
[DimTITLes].[TitLe].[Is ANGER THE ENemy?] ON ROWs
From [CubePubsSales]
Of course, these examples are for demonstration purposes, and we do not recommend writing MDX code in
this manner. Your MDX code should be consistently typed so that it will be easier to work with. To structure your
Search WWH ::




Custom Search