Database Reference
In-Depth Information
SORT(SalesByQuarter, Time, Quantity DESC)
sorts the members of the
Time
dimension on descending order of the
Quantity
measure.
The
pivot
(or
rotate
) operation rotates the axes of a cube to provide an
alternative presentation of the data. The syntax of the operation is as follows:
PIVOT(CubeName, (Dimension
→
Axis)*)
where the axes are specified as
{
X, Y, Z, X1, Y1, Z1, . ..
}
.Thus,theexample
illustrated in Fig.
3.4
e is expressed by:
PIVOT(Sales, Time
→
X, Customer
→
Y, Product
→
Z)
The
slice
operation removes a dimension in a cube, that is, a cube of
n −
1 dimensions is obtained from a cube of
n
dimensions. The syntax of this
operation is:
SLICE(CubeName, Dimension, Level = Value)
where the
Dimension
will be dropped by fixing a single
Value
in the
Level
.
The other dimensions remain unchanged. The example illustrated in Fig.
3.4
f
is expressed by:
SLICE(Sales, Customer, City =
'
Paris
'
)
The slice operation assumes that the granularity of the cube is at the specified
level of the dimension (in the example above, at the city level). Thus, a
granularity change by means of a
ROLLUP
or
DRILLDOWN
operation is often
needed prior to applying the slice operation.
The
dice
operation keeps the cells in a cube that satisfy a Boolean
condition
Φ
. The syntax for this operation is
DICE(CubeName,
Φ
)
where
Φ
is a Boolean condition over dimension levels, attributes, and
measures. The
DICE
operation is analogous to the relational algebra selection
σ
Φ
(
R
), where the argument is a cube instead of a relation. The example
illustrated in Fig.
3.4
g is expressed by:
DICE(Sales, (Customer.City =
'
Paris
'
OR Customer.City =
'
Lyon
'
)AND
(Time.Quarter =
'
Q1
'
OR Time.Quarter =
'
Q2
'
))
The
rename
operation returns a cube where some schema elements or
members have been renamed. The syntax is:
RENAME(CubeName, (
{
SchemaElement
|
Member
}→
NewName)*)
For example, the following expression
RENAME(Sales, Sales
→
Sales2012, Quantity
→
Quantity2012)
renames the cube in Fig.
3.4
a and its measure. As another example,
Search WWH ::
Custom Search