# Create Your First PowerPivot Workbook (Tutorial) Welcome to the Microsoft PowerPivot for Excel tutorial for creating

your first PowerPivot workbook. PowerPivot is an add-in for Microsoft Excel 2010 that enables you to import millions of rows of data from multiple data sources into a single Excel workbook, create relationships between heterogeneous data, create calculated columns and measures using formulas, build PivotTables and PivotCharts, and then further analyze the data so that you can make timely business decisions without requiring IT assistance. Start the tutorial now: Add Data to Your PowerPivot Workbook (Tutorial). Tutorial Scenario In this tutorial, you will complete a scenario for analyzing international electronic sales. The fictitious company, Contoso, is used for all examples. Imagine you are an analyst for an electronics company called Contoso Electronics. You want to examine sales over time and compare sales by product type, year, and country. During the course of this tutorial, you will use PowerPivot to:
      

Import data from multiple sources. Create linked data. Create relationships between data from different sources. Rename columns. Create PivotTables and PivotCharts. Add Slicers. Save the resulting Excel spreadsheet.

Prerequisites Make sure that the following are installed:
 

Microsoft Microsoft Excel 2010

For more information, see Install PowerPivot for Excel. Additionally, to follow along with the tutorial, you will need the PowerPivot for Excel Tutorial Sample Data – Version 2. The sample data that is used in this tutorial is from the fictional company Contoso and is stored in Access databases and Excel worksheets. If you prefer to import the same data from a SQL Server database instead, download and restore the full Contoso database to a server. Depending on the Contoso version there could be minor differences in the data, but you should be able to complete the tutorial successfully.

For WindowsXP
In and Windows 7, features in the PowerPivot window are available on a ribbon. In Windows XP, features are available from a set of menus. If you are using Windows XP and want to see

Create a Calculated Column (Tutorial) Create a PivotTable from PowerPivot Data (Tutorial) Create a PivotChart from PowerPivot Data (Tutorial) Add Slicers to PivotTables (Tutorial), and Add Slicers to PivotCharts (Tutorial)

Add Data to Your PowerPivot Workbook (Tutorial) As with any Excel workbook, in PowerPivot for Excel you can add data from a wide variety of data sources, including: a relational database, a multidimensional database, data feeds, an Excel table, or a Reporting Services report. You can also add data from files on your local computer, and use data that you download from the Web. However, unlike Excel, you can then create relationships between these data to form a single data set, and then perform analyses against this data. You are not limited to one million rows either -- PowerPivot enables you to add and work with millions of rows of data locally, depending on the actual physical memory available on your desktop computer. What You Will Learn PowerPivot supports importing data from a variety of sources, including: SQL Server databases, Analysis Services cubes, Access databases, Excel worksheets, text files, data feeds, and more. For a full list of supported data sources, see Data Sources Supported in PowerPivot Workbooks.

and eliminating unnecessary columns will make your workbook smaller. Clear the checkboxes at the top of the columns for all the columns from ClassID through StockTypeName (a total of 15 columns) and then click OK. select ContosoSales. 6. Click OK. This launches the Table Import Wizard which guides you through setting up a connection to a data source. if you click on that link you’ll see a textual description of the filters that you just applied. Navigate to the location where you downloaded the sample files. DimDate. Now that you have connected to the database and selected the tables to import. In the Friendly connection name field. click the arrow and deselect 7 and 8. 8. on the Home tab. clear the checkbox. go to the next section headed Filter the Table Data prior to Importing. Categories 7 and 8 include games and home appliances. Filter the Table Data prior to Importing The FactSales and DimProduct tables that you are importing from the Access database contain a subset of the data from the original SQL Server Contoso database: sales and products from two categories (games and home appliances) are not included. type ContosoDB from Access. You will apply a filter to one of the other tables before importing it. and click Open. and FactSales. so that you eliminate the same categories. 3. Select the check box for the following tables: DimChannel. Select the row for the DimProduct table and click Preview & Filter. 2. and you don't want to include those in your analysis. The Preview Selected Table window opens with all the columns in the DimProduct table displayed. Now select the row for DimProductSubcategory and click Preview & Filter. Filter the Table Data prior to Importing 1. DimProductSubcategory. you will apply a filter so that you import only the data for these categories.3. Click Next and verify that Select from a list of tables and views to choose the data to import is selected. In the PowerPivot window. click Browse. 7. 6. Since you’re interested in only some of the products. In the Database name field. You want to select from a list of tables and views. DimProduct. click From Database and select From Access. 5. 5. 4. so click Next to display a list of all the source tables within the database. 4. You will also filter out some of the columns from the DimProduct table. 7. Since the descriptions are almost identical to the names. At the top of the ProductSubcategoryDescription column. Notice that the words Applied filters are now displayed in the Filter Details column in the DimProduct row. there is no need to import both columns. At the top of the ProductCategoryKey column. Import the Selected Table and Column Data .

Click Design to open the Query Builder window. 5. In the Friendly Name box. This query selects all data from the ProductCategory table except GAMES and TOYS and HOME APPLIANCES. 2. Use a Query to Select the Data to Import The procedure for using the Table Import Wizard to import by selecting from a list of tables was described in the previous lesson in this tutorial. This starts the Table Import Wizard which guides you through setting up a connection to a data source. select ProductCategories. 9. Type ProductCategory and then click Enter. type Product Category Access DB. Validate. click the file down arrow and select All files (*. Select SQLQuery and then click Open. You can either import a query. When the import is finished. on the Home tab. Rename the new table by right-clicking the Product Category Query tab and selecting Rename. So instead of duplicating those steps.*). and then click Open. Navigate to the location where you downloaded the sample files. In this lesson. 2. click Browse. copy and paste the text of an existing query.1. A summary of the columns you are importing is displayed. In the Friendly Query Name box. The data is displayed as a new table named Product Category Query in your PowerPivot workbook. or write a new query by using the PowerPivot graphical query builder. In the Database name field. 4. and then click Next. click Close. Click Import and navigate to the location on your computer where you saved the samples. 3. If you do not see the file listed. go to the next topic: Add Data by using Copy and Paste (Tutorial). To Use the Query Designer Tool to Select the Data to Import 1. 6. click From Database and select From Access. 8. Select the Write a query that will specify the data to import option. and then Finish. Click Next. see Refreshing or Changing Imported Data. refreshing keeps your PowerPivot data up-to-date. you will import a query that you received from the IT department. The Table Import wizard guides you through the steps. 3. In the PowerPivot window. type Product Category Query. For more information. If the contents of the Access database change. Click OK. you will use a custom query to import this set of Access data. 10. . Next Step To continue this tutorial. The SQL Statement appears in the window. 7. You can keep this data current by refreshing. 4.

select Geography. Integrate columns from multiple tables into a PivotTable or PivotChart. Easily look up values in related tables using Data Analysis Expressions (DAX) formulas. Related Lookup Table DimProductSubcategory [ProductSubcategoryKey] DimChannel [ChannelKey] DimDate [Datekey] DimProduct [ProductKey] To Create Your First Relationship 1. Right-click the GeographyKey column header and select Create Relationship. To Review Existing Relationships 1. Data copied from. you should see the following relationships. relationships enable you to:    Filter data in one table by columns of data from related tables. . Existing relationships were automatically imported for you together with the data. and linked to.Why Create Relationships? In order to perform any meaningful analysis. Click the Stores tab. Product category data imported from an Access database. 2. an Excel spreadsheet that contains store information. you will create additional relationships. which were created when the first Access database was imported: Table DimProduct [ProductSubcategoryKey] FactSales [channelKey] FactSales [DateKey] FactSales [ProductKey] 3. In the Related Lookup Table field. In the PowerPivot window. 3. click Manage Relationships. In the Manage Relationships dialog box. More specifically. Create New Relationships between Data from Separate Sources Now that you have reviewed the relationships that were created automatically. on the Design tab. Review Existing Relationships You already have data from three different sources in your PowerPivot workbook:    Sales and product data imported from an Access database. The Table field and the Column field are auto-populated. 2. Click Close. your data sources must have relationships between them. in the Relationships group.

Select the StoreKey column. In the Related Lookup Column field. Create a Calculated Column (Tutorial) In this lesson you'll create new data in your PowerPivot workbook by adding a calculated column. Reverse the order. an icon displays at the top of the column. Prerequisites This topic is part of a PowerPivot for Excel tutorial. 3. In the Related Lookup Column field. select GeographyKey. select FactSales. Create a calculated column 1. see Create a Calculated Column. 7. see Create Your First PowerPivot Workbook (Tutorial). 5. Click Create. Check that all relationships have been successfully created by clicking Manage Relationships and reviewing the list. In the PowerPivot window. go to the next topic: Create a Calculated Column (Tutorial). . On the Design tab. 5. Pause the pointer over the icon to display the relationship details. Notice the icon next to the Related Lookup Column field. 4. which should be completed in order. To Create More Relationships between the data from Access and Excel 1.4. 8. 6. This tells you that this relationship is being created in the wrong order. Next Step To continue this tutorial. When you create a relationship. select StoreKey. In the Related Lookup Table field. select the FactSales table. 2. When the relationship is created. A calculated column is based on data that already exists in your PowerPivot workbook. Click the Stores tab. 9. Click Create. 6. using the ProductCategoryKey column in both tables. The Table field and the Column field are auto-populated. For more information. Select Stores as the Related Lookup Table and select StoreKey as the Column. you must select a column with unique values for the Related Lookup Column. Repeat the steps for DimProductSubcategory (as the table) and ProductCategory (as the lookup table). Move FactSales to the Table field and select StoreKey as the Column. click Create Relationship. For information about prerequisites and the first step in the tutorial.

Select \$ for Symbol. and typing Sales by Channel. Change column widths if numbers aren’t readable. In the PowerPivot window. erasing the current text. In the PowerPivot Field List. Rename the PivotTable by double-clicking Sum of SalesAmount in the first cell. select Currency and make sure that 2 is selected in the Decimal places dropdown. 2. In the DimChannel table. by quarters from first quarter 2007 through fourth quarter 2009. but standard Excel PivotTables cannot access your PowerPivot data. Select the empty PivotTable. . Highlight the data cells. 2. Select the SalesAmount field. Excel adds an empty PivotTable to the location you specified and displays the PowerPivot Field List. select the ChannelName field. Click OK. In the Excel window. Select New Worksheet. 4. The Field List displays two sections: a field section at the top for adding and removing fields. 9. right-click and select Format Cells. Ensure this field displays in the Row Labels window of the Field List. Select New Worksheet. on the PowerPivot tab. on the PowerPivot Home tab. Select the empty PivotTable. move this field from the Values box into the Column Labels box. In the Format Cells window. To Add a PivotTable to Your Analysis 1. To Add Another PivotTable to Your Analysis 1. In the PivotTable Field List. right-click the table and select Refresh Data. click PivotTable. If you get an error message telling you the data list is no longer valid. 8. If you get an error message telling you the data list is no longer valid. scroll down and locate the FactSales table. 6. and a section at the bottom for rearranging and repositioning fields. Ensure this field displays in the Values window of the Field List. 7. 5. click PivotTable. select the CalendarQuarter field.Always create PivotTables from the PowerPivot window or the PowerPivot tab in the Excel window. right-click the table and select Refresh Data. Format the display of the data to make it easier to read and compare. There is also a PivotTable button on the Insert tab in the Excel window. Excel adds an empty PivotTable to the location you specified and displays the PowerPivot Field List. The Sales by Channel PivotTable lists the sum of sales for Contoso and for each Sales Channel. In the DimDate table. 3. 3.