Chapter 3: PowerPivot: In-Depth 99
click along rather than just read, you will need the SSAS Adventure Works database
and cube and some familiarity with BIDS, in order to prepare a suitable dimension as a
multidimensional source—and the SQL Server AdventureWorksDW2008 database as
a relational source):
1. Reverse-engineer your SSAS Adventure Works database through File | New |
Project | Import Analysis Services 2008 Database. You could, alternatively,
open your Adventure Works SSAS solution. If you do so, please be careful. We
are going to make changes to a dimension, so when you deploy, make sure you
change the project name and the database name (right-click Project | Properties |
Deployment | Target | Database). If you don’t do this, you will overwrite the
SSAS Adventure Works (assuming you have it)—and we are going to totally mess
up a dimension, by way of illustration!
2. Open the Customer dimension (Customer.dim) from Solution Explorer. You
should be in the Dimension Structure tab of the dimension designer. Remove
the Country attribute hierarchy from the Attributes pane (right-click, then click
Delete)—this also removes the Country level from the Customer Geography user
hierarchy in the Hierarchies pane. We are going to relate this multidimensional
database/cube dimension to a relational source to replace the deleted country
attribute.
3. Drag the Geography Key attribute from the Customer (not from Geography)
source in the Data Source View pane on the right into the Attributes pane at the
left. Deploy and process the database with the changed dimension. To do this,
right-click on the project, and choose Deploy. Remember your project/database
name.
4. Go to PowerPivot, and from Get External Data choose From Database, From
Analysis Services, or PowerPivot. Connect to your SSAS server and your new
SSAS database. Click Next followed by Design to open the graphical query
designer.
5. In the graphical query designer, expand the customer dimension and drag in
the Geography Key attribute hierarchy (a blue rectangle) and the Customer
Geography user hierarchy (a blue pyramid/triangle). Expand Measures and Internet
Sales, and then drag in Internet Sales Amount to see data returned from the cube.
Click OK, Finish, and Close. The query designer is shown in Figure 3-36.
6. Internet Sales Amount is a measure in the cube with a DataType property of
Currency. You can verify this by selecting Internet Sales Amount in the Measures
pane of the Cube Structure tab in the cube designer and looking at the Properties
window. In PowerPivot it has a data type of Text. You can verify this by looking
at the Data Type drop-down on the PowerPivot Home ribbon. Change the data
type in PowerPivot to Currency. PowerPivot, to play it safe, always imports cube
measures as Text.