Download presentation
Presentation is loading. Please wait.
Published byDaniel Nash Modified over 11 years ago
1
1 All Powder Board and Ski Microsoft Access Workbook Chapter 9: Data Warehouses and Data Mining Jerry Post Copyright © 2007
2
2 Desired Sales Cube Dimensions Sales Dimensions State (ship) Month Category Style SkillLevel Size Color Manufacturer BindingStyle WeightMax? ItemMaterial? WaistWidth?
3
3 Early Data: Spreadsheets
4
4 Action Choose File/Get External data/Import Read the Sales spreadsheet into a new table Read the Rental data into another new table Create new entries for CustomerID and EmployeeID equal to 0
5
5 Create Customer and Employee CustomerID and EmployeeID are missing from the old data. Instead of relying on blank cell values, create a new customer called Walk-in and a new employee called Employee Write down the ID numbers generated for these anonymous entries. If you use SQL, you can assign a value of zero to these entries. INSERT INTO Customer (CustomerID, LastName) Values (0,'Walk-in') INSERT INTO Employee (EmployeeID, LastName) Values (0,'Staff')
6
6 Extract Model Data SELECT DISTINCT OldSales.ModelID, OldSales.ManufacturerID, OldSales.Category, OldSales.Color, OldSales.ModelYear, OldSales.Graphics, OldSales.ItemMaterial, OldSales.ListPrice, OldSales.Style, OldSales.SkillLevel, OldSales.WeightMax, OldSales.WaistWidth, OldSales.BindingStyle FROM OldSales;
7
7 Action Create a new query in Design view Retrieve DISTINCT data from the new sales table Retrieve DISTINCT data from the new rental table Connect the two queries with a UNION Save the query
8
8 UNION Query for Models SELECT DISTINCT ModelID, ManufacturerID, Category, … FROM OldSales UNION SELECT DISTINCT ModelID, ManufacturerID, Category, … FROM OldRentals
9
9 Action Create a new query that retrieves DISTINCT values from the saved UNION query Verify that it works Add an INSERT INTO statement above the SELECT statement to copy the data to the ItemModel table Run the query Use a similar process to add SKU, ModelID, and Size to the Inventory table Follow a similar process to copy the Sales, Rental, SalesItem, and RentalItems tables
10
10 Insert Model Data into ItemModel INSERT INTO ItemModel (ModelID, ManufacturerID, Category, Color, ModelYear, Graphics, ItemMaterial, ListPrice, Style, SkillLevel, WeightMax, WaistWidth, BindingStyle) SELECT DISTINCT qryOldModels.ModelID, qryOldModels.ManufacturerID, qryOldModels.Category, qryOldModels.Color, qryOldModels.ModelYear, qryOldModels.Graphics, qryOldModels.ItemMaterial, qryOldModels.ListPrice, qryOldModels.Style, qryOldModels.SkillLevel, qryOldModels.WeightMax, qryOldModels.WaistWidth, qryOldModels.BindingStyle FROM qryOldModels;
11
11 Insert SKU Data into Inventory INSERT INTO Inventory (ModelID, SKU, Size, QuantityOnHand) SELECT DISTINCT qryOldInventory.ModelID, qryOldInventory.SKU, qryOldInventory.Size, 0 As QuantityOnHand FROM qryOldInventory; Note the use of the column alias to force a zero value for QuantityOnHand for each row
12
12 Copy Sales Data INSERT INTO Sales (SaleID, SaleDate, ShipState, ShipZIP, PaymentMethod) SELECT DISTINCT OldSales.SaleID, OldSales.SaleDate, OldSales.ShipState, OldSales.ShipZIP, OldSales.PaymentMethod FROM OldSales; Note that if you have added data to your Sales table, your existing SaleID values might conflict with these You can solve the problem by adding a number to these values so they are all larger than your highest ID INSERT INTO Sales (SaleID, SaleDate, ShipState, ShipZIP, PaymentMethod) SELECT DISTINCT OldSales.SaleID+5000, OldSales.SaleDate, OldSales.ShipState, OldSales.ShipZIP, OldSales.PaymentMethod FROM OldSales;
13
13 Copy SaleItem Rows INSERT INTO SaleItem (SaleID, SKU, QuantitySold, SalePrice) SELECT DISTINCT OldSales.SaleID+5000, OldSales.SKU, OldSales.QuantitySold, OldSales.SalePrice FROM OldSales; If you transformed the SaleID in the prior step for the Sale data, you must do the exact same calculation for SaleID in the SaleItem table
14
14 Action Create a new query in Design view Tables: Sale, SaleItem, Inventory, ItemModel, Manufacturer Columns: ShipState, PaymentMethod, SaleMonth with a format of yyyy-mm, and Value = QuantitySold*SalePrice Sum the Value column Test the query and save it
15
15 Query for PivotTable Include all desired sale dimensions Compute Value as quantity times price Format SaleDate as year and month: yyyy-mm
16
16 PivotTable Form Wizard
17
17 Action Choose Insert/Form Select AutoForm: PivotTable Select the saved query Drag the SaleMonth and drop it on the column fields position Drag the Category and ShipState fields and drop them on the row fields position Drag the Value field and drop it in the middle Detail section Drag the other fields and drop them at the top as filter fields for future use Scroll the main grid to the far right Drop the Value field in the Totals column
18
18 PivotTable Screen Place columns (month) Place rows (State, Category) Place Value last Place other columns
19
19 Action Create quarterly groups Click on the first month and right click on the third month to highlight them Right click and select the Group/Group Items option Right click on the new cell SaleMonth1 and change its Caption property to Quarter Right click on the Group1 cell and set its caption to 2001-Q1 Repeat the process for all quarters Use a similar process to group the four years Use the Collapse option to reduce the grid display
20
20 PivotTable Right click to select all columns and choose Hide Details
21
21 PivotTable Groups
22
22 Action Create a new Excel spreadsheet Choose Data/PivotTable and PivotChart Select External data source Click the Get Data button Browse to your database and select the query built in the previous section Create a PivotTable with the SaleMonth field as rows, the Category field as columns and Value as the Detail
23
23 Action Right click on the PivotTable and select the PivotChart option In the PivotChart worksheet remove all categories except Boards, Skis, Boots, and Clothes Right click to set the Chart Type as a Line Chart Right click each series and Add Trendline Choose a linear trend and forecast it for 3 periods ahead Set properties to improve the charts appearance
24
24 Action Make sure the Data Analysis Add-Ins are installed in Excel (Tools/Add-Ins) Choose Tools/Data Analysis Select T-Test Two-sample with unequal variances Compare the Board and Ski sales
25
25 Time Series Analysis: Excel
26
26 Action If you have Microsoft MapPoint Start a new Excel worksheet Create a PivotTable with rows for ShipState and columns for Board, Boots, Clothes, and Skis Create a second worksheet that copies the main data and titles from the PivotTable without the first title rows Save the file Insert a MapPoint chart Follow the wizard instructions to add a North American map with pie charts
27
27 GIS: Microsoft MapPoint The PivotTable places the data into rows and columns A dynamic copy of this sheet is used to remove the top rows
28
28 MapPoint Data Wizard
29
29 GIS Analysis of Sales
30
30 Action Use the database command File/Get External Data/Import to read the demographic spreadsheet data Create a query to combine the sales data by state with the demographic data Copy and paste the three columns of data into a new worksheet In Excel, choose Tools/Data Analysis/Regression Select the Value column as the Y-range and the population and income columns as the X-range Check the top row as label option Run the regression
31
31 Sales by State for Regression Note that some states are missing from the list.
32
32 Regression Setup You should include the label row but be sure to check the box to show you included it
33
33 Regression Results Relatively high R-square Population is a significant predictor, income is not
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.