Database Reference
In-Depth Information
RENAME(Sales, Customer.all
→
AllCustomers)
will rename the
all
member of the customer dimension.
The
drill-across
operation combines cells from two data cubes that have
the same schema and instances. The syntax of the operation is:
DRILLACROSS(CubeName1, CubeName2, [Condition])
The
DRILLACROSS
operation is analogous to a full outer join in the relational
algebra. If the condition is not stated, it corresponds to an outer equijoin.
Given the cubes in Fig.
3.4
a, h, the cube in Fig.
3.4
i is expressed by:
Sales2011-2012
←
DRILLACROSS(Sales2011, Sales2012)
Notice that a renaming of the cube and the measure, as stated above, is
necessary prior to applying the drill-across operation. Notice also that the
resulting cube is named
Sales2011-2012
. On the other hand, if in the
Sales
cube of Fig.
3.4
c we want to compare the sales of a month with those of the
previous month, this can be expressed in two steps as follows:
Sales1
←
RENAME(Sales, Quantity
←
PrevMonthQuantity)
Result
←
DRILLACROSS(Sales1, Sales, Sales1.Time.Month+1 = Sales.Time.Month)
In the first step, we create a temporary cube
Sales1
by renaming the measure.
In the second step, we perform the drill across of the two cubes by combining
a cell in
Sales1
with the cell in
Sales
corresponding to the subsequent month.
As already stated, the join condition above corresponds to an outer join.
Notice that the
Sales
cube in Fig.
3.4
a contains measures for a single year.
Thus, in the result above, the cells corresponding to January and December
will contain a null value in one of the two measures. As we will see in
Sect.
4.4
, when the cube contains measures for several years, the join condition
must take into account that measures of January must be joined with those
of December of the preceding year. Notice also that the cube has three
dimensions and the join condition in the query above pertains to only one
dimension. For the other dimensions, it is supposed that an outer equijoin is
performed.
The
add measure
operation adds new measures to the cube computed
from other measures or dimensions. The syntax for this operation is as follows:
ADDMEASURE(CubeName, (NewMeasure = Expression, [AggFct])* )
where
Expression
is a formula over measures and dimension members and
AggFct
is the default aggregation function for the measure,
SUM
being the
default. For example, given the cube in Fig.
3.4
i, the measure shown in
Fig.
3.4
j is expressed by:
ADDMEASURE(Sales2011-2012, PercentageChange =
(Quantity2011-Quantity2012)/Quantity2011)
The
drop measure
operation removes one or several measures from a
cube. The syntax is as follows:
Search WWH ::
Custom Search