Databases Reference
In-Depth Information
as solve order and pass order. You learn about the named sets, calculated
members, and calculated measures in this chapter, and Chapter 7 covers the
rest.
The syntax of a WITH clause is
[WITH <formula_expression> [, <formula_expression>
...]]
The WITH clause provides with you the capability of specifying several calcu-
lations within one statement. The formula_expression will vary depending
upon the type of calculation, and each such calculation is separated by a
comma.
Named Sets
As you learned earlier, a set is a collection of tuples. The set expression,
even though simple, can often be quite lengthy and this might make the query
appear to be complex and unreadable. MDX provides you with the capability
of dynamically defining sets with a specific name so that the name can be
used within the query. Think of it as an alias for the collection of tuples in the
set you are interested in retrieving data from. This is called a named set. A
named set is nothing but an alias for a regular MDX set expression that can
be used anywhere within the query as an alternative to the actual set expres-
sion.
Consider the case where you have customers in various countries. Suppose
you want to retrieve the Sales information for customers in Europe, and then
you need to use the customer members in the various countries in Europe.
Your MDX query would look like this:
SELECT Measures.[Internet Sales Amount] on COLUMNS,
{[Customer].[Country].[Country].&[France],
[Customer].[Country].[Country].&[Germany],
[Customer].[Country].[Country].&[United Kingdom]} ON
ROWS
FROM [Adventure Works]
This query is not too lengthy, but you can imagine a query that would contain
a lot of members and functions being applied to this specific set several times
 
Search WWH ::




Custom Search