Database Reference
In-Depth Information
Defining calculated measures
You can add calculations to the cube at any time by simply typing calculation defin-
itions on the
Calculations
tab and saving the database. Cube-level calculations are
stored in the MDX script, which you can review on the cube designer's
Calculations
tab. This tab has two views:
Form View
and
Script View
. The
Form View
is helpful
in developing individual calculated members, calculated measures, and named sets.
The
Script View
contains all calculations as a single script, which is essentially a col-
lection of MDX statements separated by semicolons. Regardless of whether you use
Form View
or
Script View
, the
Calculations
tab includes the metadata—dimensions
and measures as well as a list of all supported MDX functions along with the syntax
reference. Additionally, SSDT also includes templates for the most common types of
calculations.
Calculated measures are measures derived by performing operations on other, previ-
ously defined measures. Calculated members are very similar but reference a dimen-
sion other than the special, measures dimension.
Calculations do not change the cube structure, and therefore, do not require re-
processing of dimensions or partitions. However, calculations do increase the cube
space by adding new cells—this is accomplished by executing the MDX script. You
can monitor what happens under the hood using
SQL Server Profiler
.
Getting ready
Launch SSDT and connect to the existing
Adventure Works
sample database,
which has been previously deployed and processed on your instance of Analysis Ser-
vices. Right-click on the
Adventure Works
cube, choose
Open
, and then navigate
to the
Calculations
tab. Also launch SQL Server Profiler, connect to the same SSAS
instance, and start a trace using the default trace template. Finally, launch SSMS,
navigate to
File
|
New
|
Analysis Services MDX Query
, and connect to the same
SSAS instance.
How to do it...
First hover your mouse pointer over each icon found on the top ribbon of the
Cal-
culations
tab to become familiar with the environment. Notice the new calculated
Search WWH ::
Custom Search