BCIS 4660 Data Warehouse Loading Data Warehouse Reporting Grading Rubric for

advertisement
Class 11.30
BCIS 4660
Data Warehouse Loading
Data Warehouse Reporting
Group Exercise 8
Hints and TIPS
Part 2
Spring 2016
Grading Rubric for
PPDW08_Team1.nn; 3 pts for
turning in correct file
Max
: 28
3
10
1
Exercise #8 [TEAM PROJECT] p. 1 of 2
Due: Sec 1 & Sec 2: Apr 21 (Thurs)
Points: 40 points
Pratt & Last: TAL Distributors Data Warehouse
Assignments must have cover sheet (deliverable 1), table of contents (deliverable 2), and
indicate the NAMES OF ALL TEAM MEMBERS and the TEAM NUMBER. Assignments
must be typed using a word processor (Word, WordPerfect) and have a professional look.
Use of ACCESS is REQUIRED for this assignment. Place Score sheet in front pocket
pockets.
•
Perform a Data Warehouse ETL for TAL Distributors. Use your [corrected]
Star Diagram from Exercise #7 and populate the tables in the model with the
new data available at the course Web site, combining at least 6 teams.
•
Part 8.1 – Data Definitions: Use your corrected Star Diagram from Hwk #7
and other necessary data definition documentation.
– Turn in a List of Relations (deliverable 3). On one (1) separate page, clearly list your
fact and dimension tables using the simplified relational notation. E.g.,
EMPLOYEE [ENum, LastName, FirstName, … deptno, …]
– Be sure to include the TEAM [and/or STATE, TERRITORY] data and add this keyfield
for every record in the ORDER_DETAIL table.
– Turn in copy of the Index Panes for each table (3a)
– Turn in a printed ACCESS ERD of your Star Diagram (deliverable 4). May be from
previous homework, if it was correct.
– Turn in a printed copy of Documenter output (d5) of Table definitions [HINT:
Tools/Analyze/Documenter/Tables – all tables]
Exercise #8 [TEAM PROJECT] p. 2 of 2
•
Part 8.2: Load data and print out your Fact and Dimension Tables.
– Load the data provided by the instructor into your tables.
• Note: Dates of all transactions should fall between 1/1/2008 and 12/31/2014
– Turn in Transformation Maps (d6): Carefully document any data cleansing activities that
you performed. Note any data problems you encountered.
– Create the necessary DETAILED transaction (lowest granularity) Fact Table that joins
all the dimension tables. Show your SQL queries.
– Turn in printouts of the contents of your fact and dimension tables (d7). Adjust their
size and give them a professional look [reduce fonts to decrease paper waste]]. Use
landscape orientation, when necessary. Make sure the data is in some reasonable order,
such as ID or date, whichever is most appropriate. Print only the first 2 pages of each
table. NOTE: See Scoresheet for Merge requirements & BONUS. 6 Merges beyond
CA & FL. i.e., Your State PLUS 5 more!!
•
Part 8.3: Generate the following SQL Queries & REPORTS:
– Use the your knowledge of SQL to create the following COMPUTED queries/views (SQL
Query) and create the corresponding ACCESS REPORTS (all reports MUST have Grand
total & Break-field Label, e.g. CustomerName, RepName, etc.): (d Tab3)
1.
2.
3.
4.
Total Sales by Month (Subtotal by Year)
Total Sales by Customer by Months for 2014-2015 (Subtotal by CustomerName )
Total Sales by Item by Month for 2014 (Subtotal by ItemName; ASC order by ItemName)
Total Sales in 2008-2009 by RepName (DESC Order by Rep Sales within Year; Subtotal by Year
for all Reps)
5. Total Sales by Territory (NE, SW, etc.) for 2008-2015 (Subtotal by Year); (Bonus 2pts) Download
to EXCEL and graph it.
6. (BONUS 5pt) Total Sales by TeamID by Year (All Years; Subtotal by TeamID; and Grand Total)
– Turn in printouts & SQL Code used for the 6 reports listed above (d8).
– Turn in .accdb file (d9) with STAR models, data, views, reports (floppy, CD, e-mail
attachment, or bring a flash disk to the instructor’s office).
• Use this naming convention: TALDW08_TeamS.xx.accdb (standard naming convention)
2
Territory Assignments
Team
State
Territory
ItemNo
RepNo
OrdNo
CustNo
1
WA
NW
GME, C
090
010000
0100
2
OR
NW
GME, D
080
020000
0200
3
AZ
SW
GME, F
070
030000
0300
4
NM
SW
PZL, A
060
040000
0400
5
MO
MW
PZL, B
050
050000
0500
6
FL
SE
TOY, G
040
060000
0600
7
NY
NE
TOY, H
030
070000
0700
8
ME
NE
TOY, I
020
080000
0800
9
OK
SW
PZL, J
010
090000
0900
10
LA
SE
PZL, K
100
100000
1000
3
Territory Assignments
Team
State
Territory
ItemNo
RepNo
OrdNo
CustNo
11
NE
MW
GME, L
110
110000
1100
12
ID
NW
GME, M
200
120000
1200
13
NV
SW
GME, N
190
130000
1300
14
TX
SW
PZL, P
180
140000
1400
15
KS
MW
PZL, R
170
150000
1500
16
AL
SE
TOY, S
160
160000
1600
17
NJ
NE
TOY, T
150
170000
1700
18
MA
NE
TOY, U
140
180000
1800
19
CO
SW
PZL, V
130
190000
1900
20
CA
SW
PZL, W
120
200000
2000
Hint: Entering Raw Data-Use the Correct Data Structure
Copy Customer Table
DataStructure ONLY
Then Input New Data with
Correct Data Structure
4
TAL Distributors Star Diagram
Time2008-2015
5.B. TAL DW -- Relation List
Fact Table
• OrderDetail [OrderNum, ItemNum, TimeKey, CustNum,
RepNum, NumOrdered, QuotedPrice, ExtendedPrice]
Dimension Tables (Full)
• Customer [CustNum, CustName, Street, City, State,
PostalCode, Balance, CreditLimit, (RepNum)]
• Rep [RepNum, LastName, FirstName, Street, City, State,
PostalCode, Commission, Rate]
• Item [ItemNum, Desc, OnHand, Category, Storehouse,
Price, (Allocation)]
• Time [TimeKey, OrderDate, Month, Cal_Year, Fiscal_Year,
Quarter, Month_Key, Month_Day, Serial_Num, Week_Num,
Julian, Day_of_Week, Day_of_Week_Num]
• State[TeamID, StateCode, StateName, TerritoryCode]
5
Transformation Maps
Very Important!! See Website
• Simply list all the adjustments, data
transformations, data cleansing you had to
perform
– Example of all SQL code used to load the
Team data into the DataWarehouse for each
table!
– Fixing CreditLimit values, if out of range
– Recovering Rep information, if missing
– Etc.
Appending Customer Tables
1. Start by renaming TALDW07SnTeamxx.accdb to
something else… like, TALDW08.accdb
2. Import Customer table from another ACCESS team into
your TALDW08.accdb; Note: The imported Customer
table will be automatically renamed CUSTOMER1.
3. Un-link CUSTOMER1.CustomerNum from any other
tables (if necessary in the ERD Diagram)
4. Select Customer1, make sure all fields are Union
compatible; move all fields to QBE grid.
5. Create a Customer Append query (see next slide)
6. Execute the query and make sure all NON-DUPLICATE
records from Customer1 were appended to Customer
correctly (Avoid duplicate FL & CA records being
added)
7. Repeat for Customer2 etc.
6
Prepare for the Append Customer Query
4. Add Customer1 to QBE grid
Select all columns and move to
Grid (see below)
5. Select APPEND query
And use Customer table
Design View (QBE) Result of Append
6. NOTE: Exclude duplicate “FL” & “CA” records criteria
Also, may use <> “FL” and <> “CA” or see below;
Note: No matching RepNum in Customer (OK?)
6. (cont.) First examine Datasheet View;
then Run the Query;
7
SQL Code: Append
Customer1 to Customer
INSERT INTO Customer ( CustomerNum, CustomerName, Street, City, State,
Zip, Balance, CreditLimit )
SELECT Customer1.CustomerNum, Customer1.CustomerName,
Customer1.Street, Customer1.City,
Customer1.State, Customer1.Zip, Customer1.Balance, Customer1.CreditLimit
FROM Customer1
WHERE (Customer1.State) = “WA”;
or
WHERE (Customer1.State) NOT IN ("FL“, “CA”);
NOTE: Avoid appending duplicate FL records
Alternatively: <> “FL” and <> “CA”
HINT: Works for Rep Table, too!
Referential Integrity Problem
with Part and OrderDetail
Probable Cause: Missing parent record in Item Table.
Use Unmatched Query Wizard to find missing parent in Item
8
Creating Reports
Total Sales By Month
• Use Query Builder to create the “VIEW” needed to solve
the report specifications; as in BONUS Homework #7
– Join OrderDetail with needed Dimension Table
•
•
•
•
Use Report Wizard to create “template” report
Select VIEW as the “raw data”
Add MonthNum as a grouping level, click Next
Click Summary Options, check Sum of OrderDollars and
select Summary only
• Adjust “Sorting and Grouping” options manually to
“MONTH”
– See next slide
• Add “Text Box” to Group footer and Report Footer and
insert =SUM([OrderDollars]) formula (see below)
9
A different way to create the
Total Sales By Month Report
• Use Month_key attribute in the Time table, containing
the month as a number; Sort by Year first
Create a select query that selects the Year,
Month_key, and Month, and OrderDollars of
each OrderDetail record,
Then groups by Year, and Month_key and
calculates the SUM of OrderDollars
Report Wizard Approach
You may create any report by starting with
the report wizard. NOTE: However, this is
not the best approach for all queries:
1.Run Simple Report Wizard
2.Select the Report Query
– Remember: MOV
3.Select the Columns you wish to include
4.Select Grouping options
5.If 4., then select Summary Options
10
MOV: Then Report Wizard
Subtotal Sales by Year,
Month_key, Month
Select the Fields
Report Wizard (cont.)
Select Additional Grouping
Levels: Cal_Year
Add additional sorting;
then “Summary Options”
11
Summary Options:
OK; Next; Finish
Print Preview
12
1st Iteration Edit: Report Design View
2nd Iteration Edit: Report Layout View
13
Another way to create the Total
Sales By Month Report
• Then create a Report using the wizard: Select all 3
columns of the total monthly sales query, add a grouping
level by Year. Finish the wizard, open the report in
design view and make the font of the data (Month and
TotalSales) somewhat bigger (e.g. Arial 12)
Sorting and Grouping Options
Add Footer
“Yes”
Set to “Month”
14
Adjust FORMATs
“Currency”;
2 Dec. Places
Copy & Paste SUM() to
Report Footer Section
15
Grand Total Sales
Grand Total Sales
Final Touches
Adjust all other Formats:
Column Headings, Report Headings, Page and
Report footings
Access Switchboard:
GUI for running Data Warehouse
Reports, Forms, Queries, etc.
Preview Switchboard for Homework #9:
1.Tools/Database Utilities/Switchboard; or
– Add Switchboard to top toolbar
2.Create New Switchboard
3.Link to Access Objects:
– Reports, Forms, Queries, and other Menus
16
Examine TAL Switchboard-Part of Orignal TAL TPS
General Hierarchical Menu/
Switchboard System
Main
Menu
Maintain
Data Menu
Add New
Customer
Update/Delete
Customer
Customer List
Data
Warehouse
Reports
Query
Database
17
The End
18
Download