Database Reference
In-Depth Information
Figure 9-14.
Choosing the DimDate table
If you do not have the
AdventureWorksDWH
database, you can download it from the following link:
■
You will see a lot of sample database files available for download when you link to the site just mentioned.
for this chapter, download the file that says
AdventureWorksDW2012 Data File
. after the download is complete, make
sure you attach the database to your sQl server instance. You can do so using the sQl server
Attach Databases
wizard
or simply executing the following sQl statement:
Note
EXEC sp_attach_single_file_db @dbname = 'AdventureWorksDWH', @filename =
'<path>\AdventureWorksDW2012_Data.mdf'
Once the import of the
DimDate
table is done, your PowerPivot data model will have two tables loaded in it. The
tables are named
stock_analysis
and
DimDate
.
Creating a Stock Report
Once the two tables are loaded into the PowerPivot model, click on
Diagram View
and connect the
DimDate
table
with the
stock_analysis
table using
Full Date Alternate Key
and
stock_date
as shown in Figure
9-15
. (Drag
stock_date
to
the
Full Date Alternate Key
column.)