Databases Reference
In-Depth Information
Adding Calculations to Your Cube
In Chapter 6 , you learned how to use the Calculations tab in the cube designer
for creating calculated members and named sets. In Chapter 7 , you learned
about the calculation model in Analysis Services 2005 and how cell calcula-
tions are created within MDX Scripts. In this section, you learn how to review
and test cell calculations.
You use the Calculations tab in the cube designer to define all calculations
which then become part of the MDX script of your cube. In this section, you
continue using the Adventure Works DW sample project included with Mi-
crosoft SQL Server 2005 product to explore the functionality available in the
Calculations tab.
The following steps show how to review the definitions of some of the calcula-
tions defined in the Adventure Works sample cube and how to verify the res-
ults as the calculations are applied to the specific cells:
1. Open the Adventure Works DW sample project located at C:\Program
Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks Ana-
lysis Services Project\Enterprise and, if you haven't done so already,
deploy the project to the Analysis Services instance on your machine.
If you have a default Analysis Services instance, you can deploy the
project without changing the project properties. However, if you have
installed named instances of Analysis Services and SQL Server you
must change the project's deploy properties to target the right in-
stance of Analysis Services and you must also change the relational
data source in the project to point to your SQL Server instance.
2. Open the Adventure Works cube and click the Calculations tab. You
will see all the calculated members, named sets, and calculations
specified within the MDX script as shown in Figure 9-15 . The first
command selected in the Script Organizer, which is also the first com-
mand in the MDX script, is the Calculate statement. The Calculate
statement is automatically added to each cube created by the cube
wizard. The Calculate statement can be anywhere within the MDX
script, but it must be included so be careful not to delete it. You can
also add comments to the MDX script to make it easier to understand
the purpose of the calculations by inserting your comments between
the /* and */ characters as shown in Figure 9-15 . All comments within
 
Search WWH ::




Custom Search