Use Lab (Computer Room) to Access Microsoft Excel Powerpivot

Total Page:16

File Type:pdf, Size:1020Kb

Use Lab (Computer Room) to Access Microsoft Excel Powerpivot

BORDEAUX: BUSINESS INTELLIGENCE POWERPIVOT LAB

Use Lab (computer room) to access Microsoft Excel PowerPivot

Or

Installing PowerPivot for your laptop

PowerPivot is a free add-in for Excel 2010 brought to you by the SQL Server Analysis Services team at Microsoft. To improve Excel as a Business Intelligence (BI) tool, PowerPivot makes it possible to do advanced data analysis through personal BI in Excel.

To install PowerPivot, the trick is to make sure this add-in matches your version of Excel. Please go to the File menu in Excel 2010 and select Help. The right side of the backstage view shows a version number. If the version number ends with 64-bit, then you need the 64-bit add-in version. If it is a 32-bit, please use 32-bit version of PowerPivot add-in.

Go to http://www.microsoft.com/en-us/download/details.aspx?id=29074 for the download.

After installing the add-in, you should see a PowerPivot tab added to the Excel 2010 ribbon, as shown below:

Lab Exercise 1: Using PowerPivot to analyze data in the AdventureWorksDW2012 Download Data File: AdventureWork_1.xlsx

1.1 What was the total sales amount in 2008? ______

1.2 How much money was made on Clothing Sales to Value Added Resellers in 2007? ______

1.3 What was the total sales amount for Bikes in 2005?

Bordeaux – Business Intelligence Applications and Tools Page 1 ______

1.4 What was the total sales amount for the Product Mountain-500, Silver, 40 in 2007? ______

(Optional – Demo) Import data from SQL Server Management Studio:

1) Open Excel 2010, and then save the empty workbook as Adventure Works.xlsx on your local hard drive.

2) Select the PowerPivot tab in Excel 2010

3) Select the PowerPivot Window icon, the first on the blue ribbon. A new PowerPivot application window appears. PowerPivot offers two tabs: Home and Design.

Note: you can’t create PowerPivot reports directly from data in Excel worksheets as you can do with Excel Pivot table. Before you can analyze data, you must create a PowerPivot model and import the data.

4) You want to import table data here. From Get External Data group, select From Database  From SQL Server.

5) Use the Table Import Wizard to connect AdventureWorksDW2012 at omisbi1.niunt.niu.edu or localhost

6) Follow the Table Import Wizard to select DimReseller, DimProduct, DimProductSubcatory, DimProductCategory, DimDate, and FactResellerSales tables.

Bordeaux – Business Intelligence Applications and Tools Page 2 7) Change the Friendly Name from the Select Tables and Views as shown in the figure below.

8) Click Finish to import these tables in PowerPivot window  Close.

Note: PowerPivot has a much broader data reach and can import data from any accessible data source. It organizes data in tables that can be joined with relationships.

9) Save the entire workbook Adventure Works.xlsx on your local hard drive.

Understanding Pivot Reports from PowerPivot:

Note: The figure below shows the Excel PowerPivot modeling and Pivot table analysis lifecycle. As you’ve seen, model development takes place in the PowerPivot window that represents the PowerPivot modeling environment. PowerPivot falls back on Excel for data analysis and

Bordeaux – Business Intelligence Applications and Tools Page 3 reporting. The PowerPivot model, data, and reports are saved in a single Excel workbook file.

10)PowerPivot uses Excel Pivot for data analysis and reporting. Click PivotTable button and Select PivotTable from the Home ribbon of the PowerPivot.

11)Complete the Lab exercises 1.1, 1.2, 1.3, & 1.4.

Understanding Slicers to make a PivotTable report interactive with users:

12)In the PowerPivot window (Data View), click the Product table tab.

13)Rename the EnglishProductName column to Product Name.

14)Repeat the step above to rename the EnglishProductCategoryName column to

Bordeaux – Business Intelligence Applications and Tools Page 4 Category from the ProductCategory table and rename the EnglishProductSubCategory column to SubCategory from the ProductSubCategory table.

15)Save the changes and click the Excel icon to switch back to your Excel Workbook.

16)Click the Refresh button from the PowerPivot Field List.

17)Click anywhere inside your Pivot table, drag Category, and SubCategory columns into Slicers Vertical zone in the PowerPivot Field List window. Analyze data based the Category and SubCategory slicers.

Note: You can hold the Ctrl key to select multiple values or the Shit Key to select adjacent values.

18)Remove SubCategory from the Slicers Vertical zone and make sure to include CalendarYear in the Column Labels zone and Product Name in the Row Labels zone. Drag EnglishMonthName into the Slicers Vertical zone. Analyze data based the Category and EnglishMonthName slicers.

Sorting Date based on Data Source:

19)The EnglishMonthName slicer should be in ascending order as showed in the figure above. In the PowerPivot window (Data View), click the Date table tab to activate the Date table.

Bordeaux – Business Intelligence Applications and Tools Page 5 20)Click the column header of the EnglishMonthName column to select it.

21)In the PowerPivot Home ribbon tab, click the Sort by Column button.

22)In the Sort by Column dialog box, expand the right drop-down list, and then select the MonthNumberOfYear column to sort the EnglishMonthName column in the same order, as shown in the figure below  Click OK.

23)Save the changes and click the Excel icon to switch back to your Excel Workbook.

24)Click the Refresh button from the PowerPivot Field List.

25)Right click on the EnglishMonthName slicer select Sort Data Source Order.

Working with Hierarchies:

A hierarchy is a combination of columns that defines a navigational drilldown path in the model. In this exercise you will build a Product Hierarchy with Category, SubCategory, and Product Name.

26)In the PowerPivot window (Data View), click the Product table tab.

27)Click the first empty cell in the Add Column (the last column of the Product table). Type the following Data Analysis Expression (DAX): =RELATED(ProductCategory[Category])

Bordeaux – Business Intelligence Applications and Tools Page 6 Note: You can use the RELATED(Column) and RELATEDTABLE(Table) functions for navigating relationships in the model. The RELATED function follows a many-to-one relationship, such as from a fact table to a dimensional (lookup) table.

28)Rename the column header and name it as ProductCategory.

29)Repeat steps 27-28 to create a ProductSubCategory column in the Product table. Use the DAX function =RELATED(ProductSubCategory[SubCategory]). It should look like the figure below:

30)You can use Diagram View to create hierarchies. Save your work and in the PowerPivot Home ribbon tab, click the Diagram View button.

31)Click the Create Hierarchy button found in the top-right corner of the Product table, as shown in the figure below.

32)Double-click the new Hierarchy 1 hierarchy and rename it to Product Hierarchy.

33)Right-click the ProductCategory column and click Add to Hierarchy Product

Bordeaux – Business Intelligence Applications and Tools Page 7 Hierarchy.

34)Add also the ProductSubCategory and Product Name columns to the hierarchy by repeating the step 33.

35)Save the changes and click the Excel icon to switch back to your Excel Workbook.

36)Click the Refresh button from the PowerPivot Field List.

37)Use the Product Hierarchy to answer the question:

What was the sales amount of Cable Lock in 2007?

______

Implementing a Pivot & PivotChart Report:

38)Open the Adventure Works workbook with your saved above exercises (if you have closed the Excel).

39)Click the Excel ribbon’s PowerPivot tab, and then click the PowerPivot window button. The PowerPivot window opens.

40)On the Home ribbon tab, expand the PivotTable drop-down button, and then click Chart and Table (Vertical) Layout.

41)In the “Create PivotChart and PivotTable (Vertical)” dialog box that follows, select the New Worksheet option.

Bordeaux – Business Intelligence Applications and Tools Page 8 42) Add data to PivotTable to create a crosstab report. In the PowerPivot Field List, expand the ResellerSales table. Check the checkbox next to OrderQuantity field.

43)To show order quantity grouped by Category on rows, in the PowerPivot Field List, expand ProductCategory table, and then drag the Category field into the Row Labels.

44)To show the report data grouped by years on columns, expand the Date table in the PowerPivot Field List, and then drag the CalendarYear field to the Column Labels zone.

45)Suppose you want to see the level of details behinds a cell, such as to understand which rows contribute to the Bike order quantity for the year of 2007. Right-Click that cell and then click Show Details.

46)Return to the PivotTable sheet, and format the order quantities with “1000 Separator (,)” without any decimals.

47)Click anywhere in the PivotChart section to select it. Notice that the PowerPivot Field List refreshes and no fields are selected because the chart is empty.

48)Check the OrderQuantity field in the ResellerSales fact table.

49)Expand ProductCategory table, and then drag the Category field into the Axis Fields (Categories) zone.

50)To show the chart data grouped by years, expand the Date table in the PowerPivot Field List, and then drag the CalendarYear field to the Legend Fields (Series) zone.

Bordeaux – Business Intelligence Applications and Tools Page 9 51)Your results should look similar as the figure shown above. Do add a chart title of Reseller Orders by Product Category.

52)Play with the buttons (CalendarYear and Category) to make the Chart dynamic. In addition, you can right-click any of the gray field buttons, and then click “Hide All Field Buttons” on Chart. To restore it, go to the Analyze ribbon in the PivotChart Tools, and then click the Field Buttons.

Working with Relationships (1):

53)In the PowerPivot window, click the Diagram View button. Take some time to explore the model schema and to experiment with the Diagram View features, such as zooming.

54)Notice that there are three connection lines (relationships) between the Date and ResellerSales tables. Hover your mouse cursor over the solid connection line between the Date and ResellerSales. Notice that Diagram View highlights the related columns for OrderDateKey from the ResellerSales table and the DateKey from the Date table.

Bordeaux – Business Intelligence Applications and Tools Page 10 55)The ResellerSales table has the OrderDateKey, ShipDateKey, and DueDateKey columns because a sales order has an order date, ship date, and due date. There is only one relationship can be active. In this example, ResellerSales[OrderDateKey] Date[DateKey]. The other two relationships are inactive and are shown as dotted lines.

56)Suppose you prefer to use ship date when slicing the ResellerSales table by date. You need to make the relationship between ResellerSales[OrderDateKey] and Date[DateKey] inactive. Click the Design ribbon tab in the PowerPivot table, Click Manage Relationships button.

57)Select the relationship between ResellerSales[OrderDateKey] and Date[DateKey], then select Edit. The Edit Relationship box displays as below:

Bordeaux – Business Intelligence Applications and Tools Page 11 58)Un-check the Active box  Click OK. Repeat the steps above to active the relationship between ResellerSales[ShipDateKey] and Date[DateKey].

59)When complete, re-active the relationship between ResellerSales[OrderDateKey] and Date[DateKey].

Question: What is an alternative approach to active all three dates relationships?

______

(Optional Demo) - Importing additional tables and Working with Relationships (2):

60)In the PowerPivot window, click the Design ribbon tab. Click the Existing Connection button.

61)In the Existing Connection dialog box, make sure that your AdventureWorksDW2012 connection is selected, and click the Open button to start the Table Import Wizard.

62)In the “Choose How to Import the Data” step, leave the default choice to select from a list of tables.

63)In the Select Tables and Views steps, check the DimCustomer (Customer as a friendly name), DimEmployee (Employee as a friendly name), DimGeography (Geography as a friendly name), DimSalesTerritory (SalesTerritory as a friendly name), and FactInternetSales (InternetSales as a friendly name) tables.

Bordeaux – Business Intelligence Applications and Tools Page 12 Note: In the AdventureWorksDW2012 data warehouse, the DimGeography table isn’t related directly to the FactInternetSales table. Instead, DimGrography joins DimCustomer, which joins FactInternetSales. This is an example of a snowflake schema that I discussed in the class.

64)Add one more table DimCurrency (Currency as a friendly name) into the model.

65)As shown in the figure above, a total of 12 tables are for this exercise (or download AdventureWork_2.xlsx). In the Home ribbon in the PowerPivot window, click the Diagram View button.

66)Examine the relationships.

Question: What relationships are missing from the Diagram View (three only)?

______

______

______

67)Note: When creating a relationship, start with the table that’s on the many side. For example, create a relationship between InternetSales[OrderDateKey] and Date[DateKey]. Right-click on the InternetSales[OrderDateKey]  Create Relationship

68)In the Create Relationship window, select Date from the Related Lookup Table, and DateKey in the Related Lookup Column.

69)Click Create button as shown in the figure below.

Bordeaux – Business Intelligence Applications and Tools Page 13 70)Create a relationship between ResellerSales[EmployeeKey] and Employee[EmployeeKey].

71)Create a relationship between ResellerSales[CurrencyKey] and Currency[CurrencyKey]

72)Click Save and return back to the PowerPivot table.

Working with Perspectives:

A perspective represents a subset of the model metadata. Its main purpose is to reduce the perceived complexity of a busy model and to expose a subset of the model metadata. In this exercise, you will create a Retail Perspective and an Internet Perspective from the model.

73)If you don’t see an Advanced tab in the PowerPivot window, expand the drop-down menu in the Quick Access toolbar, and then click Switch to Advanced Mode.

74)PowerPivot adds a new Advanced tab to the ribbon. Click the Advanced ribbon tab, and then click the Perspectives button.

75)Click the New Perspective button. Type in Reseller Sales as a name for the new perspective, and then press Enter.

76)Click the Currency, Date, Employee, Product, ProductCategory, ProductSubCategory, Reseller, ResellerSales, and SalesTerritory tables.

Bordeaux – Business Intelligence Applications and Tools Page 14 77)Follow similar steps to create an Internet Sales perspective that includes Currency, Date, Customer, Product, ProductCategory, ProductSubCategory, Geography, InternetSales, and SalesTerritory tables. Compare your results with the figure below:

78)Click OK to close the Perspectives dialog box.

79)To test the new perspectives, switch to Diagram View. Expand the Select Perspective drop down list, and then select Reseller Sales perspective. Note that diagram shows only reseller related objects.

80)Test the Internet Sales perspective as well.

Question: What additional relationships are missing from the Diagram View?

______

Bordeaux – Business Intelligence Applications and Tools Page 15 ______

81)To test perspectives with Excel, create a pivot report. Notice that the PowerPivot Field List recognizes perspectives and adds a drop-down list at the top of the pane.

Case Study on Creating a Dashboard Report:

In this exercise, you will create a dashboard similar to the figure shown below. This dashboard includes four chart sections of (a) Pie Chart (Pie in 3-D) – Internet Order by Product Category (b) Column Chart (Cluster Column) – Top 10 Resellers (c) Bar Chart (Cluster Bar) – Sales by Employee (d) Radar Chart (Filled Radar) – Sales by Reseller Type and two slicers arranged vertically to filter data by (a) Year (b) Month

Note1: Please use the Four Charts option under the Pivot Table in the PowerPivot window for the dashboard design.

Note2: Please make sure to format the chart and display them professionally.

Lab Exercise 2: Using PowerPivot to connect multiple related EXCEL files

Bordeaux – Business Intelligence Applications and Tools Page 16 Objective: In this exercise, you will work on Excel data files for PowerPivot data analysis. The most import concept here is to LINK your Excel data together in the PowerPivot window.

82)Download “Lab4_2 Start.xlsx” and “Reseller Sales Source.xlsx” Excel files.

83)Open Lab4_2 Start.xlsx. This file represents the starting point for this exercise and contains additional data that you’ll later use.

84)Click the PowerPivot tab in the ribbon.

85)In the PowerPivot ribbon, click the PowerPivot window button.

86)In the PowerPivot window, click the From Other Sources button to lunch the Table Import Wizard.

87)Scroll down the list until you see the EXCEL file option, select it and click Next.

88)In the “Connect to a Microsoft Excel File” step, type Sales as a friendly connection name to help you identify this connection. Find the file of “Reseller Sales Source.xlsx”

89)Check the “Use first row as column headers” option.

90)Click Next.

91)In the “Select Tables and Views” step, check Sheet1$ because the reseller data you need to import is located in first worksheet.

Bordeaux – Business Intelligence Applications and Tools Page 17 92)Type Sales in the friendly name column next to Sheet1$.

93)Click Finish and Save the Excel workbook and PowerPivot model.

94)In the Excel workbook, click the Reseller worksheet tab on the bottom, and then click the PowerPivot tab on the Excel ribbon. Don’t click the PowerPivot window button yet.

95)Click the “Create Linked Table” ribbon button. Excel selects all the data in the Reseller worksheet and pops up a Create Table dialog box to confirm the table selection. If the dialog box has the “My Table Has Headers” checkbox unchecked, check it, and then click OK.

96)Excel converts the worksheet data into an Excel table, opens the PowerPivot window, and then adds a new table named Table1 to the PowerPivot model.

97)Right-click the Table1 tab at the bottom, and then click Rename. Type “Reseller” and then press Enter to rename the table to Reseller.

98)Click “Switch to Workbook” button to go back to the Excel window. Click the Date tab and follow the same steps to create a new linked table. Rename the new table to Date.

99)Compare your results with the figure below. The PowerPivot model should have three tables: Sales, Reseller, and Date.

Bordeaux – Business Intelligence Applications and Tools Page 18 Hands-On

Hands-on 1

Specify how to create table relationships among Sales, Reseller, and Date table in the PowerPivot model in above Lab Exercise 2. Show the final Data Diagram.

Hands-on 2

Create your own Dashboard (4 charts with slicers) similar with the case study at the end of Lab Exercise 1. Submit the design and write a short paragraph to describe your dashboard.

Hands-on 3

Create a new hierarchy for the Sales Territory table. Use the Pivot table to analyze data from your discretion with the new hierarchy. Show the result.

Bordeaux – Business Intelligence Applications and Tools Page 19

Recommended publications