may woo bi portfolio

26
Business Intelligence Portfolio Name: May Woo Email: [email protected] Phone: 253.520.6683 1 May Woo Business Intelligence Portfolio 2009

Upload: maywoo

Post on 31-May-2015

544 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: May Woo Bi Portfolio

Business Intelligence Portfolio

Name: May WooEmail:

[email protected]: 253.520.6683

1May Woo Business Intelligence Portfolio2009

Page 2: May Woo Bi Portfolio

Table of Contents

Project Overview………………………………..3

T-SQL Samples…………………….……………4

SSIS – Integration Services…………………………7

SSAS – Analysis Services………………………….10

MDX Samples………………………………….12

KPI’s, Excel Services - Sample……..……………….16

SSRS – Reporting Services ………………………..18

MOSS/PPS – Share Point and Performance Point Services…21

2May Woo Business Intelligence Portfolio2009

Page 3: May Woo Bi Portfolio

Project OverviewIntroduction: This portfolio contains selected examples of my development skills in Microsoft Business Intelligence

arena.

Core technologies covered:• Microsoft SQL Server 2005 T-SQL• Microsoft SQL Server 2005 MDX• Microsoft SQL Server 2005• Microsoft SQL Server 2005 Integration Services (SSIS)• Microsoft SQL Server 2005 Analysis Services (SSAS)• Microsoft SQL Server 2005 Reporting Services (SSRS)• Microsoft Office Performance Point Server (PPS)• Microsoft Office SharePoint Server 2007 (MOSS)

Audience:• Business executives• Information workers• IT managers

Project Goals:• Define a Star Schema database using Visio (four fact tables)• Create a staging database (Visio created the DDL)• Create an ETL solution to update the SQL Server 2005 database from Excel and flat file sources using

SSIS• Create a Star Schema Analysis Services cube with SSAS• Write MDX queries based on specifications• Define Calculated Members and business Key Performance Indicators (KPI’s) in SSAS• Use Excel Services 2007 to display the cube data and the KPIs, displaying statuses and trends • Produce detail and summary reports using SSRS• Create score cards using MS Office Performance Point• Implement business Intelligence dashboards using MOSS 2007 (SharePoint)

3May Woo Business Intelligence Portfolio2009

Page 4: May Woo Bi Portfolio

T-SQL Samples/*May WooUsing the UNION operator to combine result sets of separate queries*/SELECT a.state

,a.member_no,count(*) as numkids

FROM juvenile AS jINNER JOIN adult AS a

ON j.adult_member_no = a.member_noWHERE a.state = 'CA'

GROUP BY a.member_no, a.state Output from left query:HAVING COUNT(*) > 3

UNIONSELECT a.state

,a.member_no,count(*) as numkids

FROM juvenile AS jINNER JOIN adult AS a

ON j.adult_member_no = a.member_noWHERE a.state = 'AZ'

GROUP BY a.member_no, a.stateHAVING COUNT(*) > 2

Output from left query:

4May Woo Business Intelligence Portfolio2009

state member_no numkids----- --------- -----------AZ 25 4AZ 117 3CA 95 4CA 141 4CA 187 4

/*May WooThis query uses subquery as an expression to get the list of books that have more than 50 copies in reserved.*/SELECT t.title_no, title, l.isbn ,count(*) AS 'Total Reserved' FROM title ASt INNER JOIN loan AS l ON t.title_no = l.title_no INNER JOIN reservation AS r ON r.isbn = l.isbn WHERE r.isbn IN ( SELECT isbn FROM reservation GROUP BY isbn HAVING COUNT(*)> 50 ) AND l.copy_no < 5 GROUP BY t.title_no, title, l.isbn

title_no title isbn Total Reserved--------- ------------------------------- --------- --------------1 Last of the Mohicans 1 1975 Fall of the House of Usher 43 19625 The Black Tulip 246 19629 Misalliance 288 19733 The First 100,000 Prime Numbers 330 1964 Songs of a Savoyard 533 1968 The Cherry Orchard 575 19732 The Call of the Wild 820 19641 Sense and Sensibility 904 196(9 row(s) affected)

Page 5: May Woo Bi Portfolio

T-SQL Samples/*May WooCombine columns to create full name*/SELECT firstname+' '+isnull(middleinitial+' ','')+lastname AS 'Name' , Street, City, State, ZipFROM dbo.member me INNER JOIN dbo.adult ad ON me.member_no=ad.member_noORDER BY lastname, firstname

5May Woo Business Intelligence Portfolio2009

Name Street City State Zip--------------------------------- --------------- --------------- ----- ----------Amy A Anderson Bowery Estates Montgomery AL 36100 Amy B Anderson Elm Street Denver CO 80201 Amy B Anderson The Highlands Atlanta GA 30026 Amy C Anderson King Street Baton Rouge LA 70800 Amy D Anderson New Pike Road Trenton NJ 08600 Amy E Anderson Queen Ann Drive Salem OR 97301 Amy F Anderson Tamarack Road Salt Lake City UT 84100 Amy G Anderson Willow Road Charleston WV 25300 Amy H Anderson Cannery Row Phoenix AZ 85011 Amy H Anderson Fir Street Washington DC 20510-0001

/*May WooQuery to declare and use variables in a SQL statement.*/use JungleBooksdeclare @txtLastFourDigits char(4)set @txtLastFourDigits ='7889'select CustomerID as 'ID', CardNumber as 'Card Number', left(ExpiryDate, 11) as 'Expires'from Customerswhere CardNumber like '%' + @txtLastFourDigitsorder by 'ID'ID Card Number Expires----------- -------------------- -----------21 7898-3233-3223-7889 Jan 31 2002(1 row(s) affected)

Page 6: May Woo Bi Portfolio

T-SQL Samples

2009 May Woo Business Intelligence Portfolio 6

/*May WooUse Case statement, and where statement to filter the desired result*/SELECT

books.ISBN, PUBLISHER,QUANTITYORDERED-QUANTITYDISPATCHED AS [Quantity Needed],orders.orderid, CASE

WHEN orderdate+3 < getdate() and quantityordered>quantitydispatched

THEN 'Needs Review' ELSE 'Standard Delay' END AS [STATUS]

FROM BOOKS inner join ORDERITEMS on books.isbn=orderitems.isbninner join orders on orderitems.orderid=orders.orderidWHERE QUANTITYORDERED>QUANTITYDISPATCHED and stock=0GROUP BY

books.ISBN, PUBLISHER,orderdate,orders.orderid,quantityordered,quantitydispatched

ORDER BY [quantity needed] desc

ISBN PUBLISHER Quantity Needed orderid STATUS-------------------- -------------------------------------------------- --------------- -----------------------------------------097-972-0261 Lucerne Publishing 2 21 Needs Review097-972-0261 Lucerne Publishing 2 22 Needs Review097-972-0261 Lucerne Publishing 2 23 Needs Review097-972-0261 Lucerne Publishing 1 36 Needs Review72-80081-024 New Moon Books 1 37 Needs Review9-001-122-01 Binnet and Hardley 1 29 Needs Review9-001-122-01 Binnet and Hardley 1 30 Needs Review9-001-122-90 Binnet and Hardley 1 27 Needs Review097-972-0261 Lucerne Publishing 1 20 Needs Review (9 row(s) affected)

Page 7: May Woo Bi Portfolio

SSIS – Integration ServicesIntegration Services• Create packages to transfer the data from different raw data sources (EXCEL, CSV). Data Sources

are both normalized and non-normalized.• Do a full load of data into MS SQL Server 2005.• Run Scheduled packages nightly to import/update any additional information.• Perform validation to detect errors (e.g. child records with invalid parent records).• Generate emails with the results, including rows inserted, updated. Errors are redirected to log

files which become email attachments.• Create a separate package to re-index and shrink the database, as well as perform nightly backups

of the database.

Screenshots:• This package is required reading multiple CSV files and totaling record counts for all files. Following

are the Control Flow and Data Flow screenshots.Control Flow for a package

7May Woo Business Intelligence Portfolio2009

Page 8: May Woo Bi Portfolio

SSIS – Integration Services

8May Woo Business Intelligence Portfolio2009

Notification: Example below shows how to create email notification alerts when a SSIS package completes, and there are invalid (bad) data in the source. Similar email is sent when the package is successfully inserted into the target.

Top screen shot shows Employee Package using ‘Send Mail Task’ in Control Flow Designer for both successful and failed run of the package. Bottom is the screen shot of email notification itself. See next page on creating email using Properties under Expression.

Page 9: May Woo Bi Portfolio

SSIS – Integration ServicesCreation of Email: Top screen shot show sample creation of Employee Package send email

notification in Expression Builder of ‘Send Mail Task’ Properties in Control Flow Designer.Master Package to combine all 8 packages of the project: The bottom screen shot shows combine all 8

packages into ‘Sequence Container’ , then run backup, shrink and rebuild indexes and send email notification on status of each package.

9May Woo Business Intelligence Portfolio2009

Page 10: May Woo Bi Portfolio

SSAS – Analysis ServicesDesign the Data Source View using BIDS• Restore the All Works Database from the backup file.• Create the four fact tables from the scripts provided by the DBA.• Create the calendar table (AllWorksCalendar) from the script provided by the DBA.• Establish database connection.• Use “Service Account” for login credentials.• Select the tables to be used, including the fact tables and the dimension tables.• All tables are indicated in the screen shot that follows.• The DSV relationships are not completely established, and must be defined manually. Utilize the

Data Source View (DSV) Diagram for All Works Data Source, define the primary key foreign key related members between tables, and save.

Here is the DSV Diagram:

10May Woo Business Intelligence Portfolio2009

Page 11: May Woo Bi Portfolio

SSAS – Analysis ServicesDesign the Cube using BIDS• Utilize the Cube Wizard to build the All Works Cube• Automatically create attributes and hierarchies• Verify that the Fact tables and Dimension Tables properly identified• Verify measures by measures group• Verify dimensions• Use Dimension Usage tab to verify dimensions used in each fact table• Edit AllWorksCalendar Dimension to rename levels and to create hierarchy

Here is the Cube Design and Dimension Editor:

11May Woo Business Intelligence Portfolio2009

Page 12: May Woo Bi Portfolio

MDX SamplesThe MDX script below shows all employees for 2005 Q4 (this period), and four periods ago

(prior period), for total hours worked in the Quarter.Use IIF (Immediate IF) statement to display NULL as zero.

12May Woo Business Intelligence Portfolio2009

/*Name: May WooDate: 08/21/2009Company: SetFocus LLCJob Name: Job Labor Fact Query 04-05Job Description: Show All employees for 2005 Q4, and four periods ago, for total hours

worked in the Quarter, display NULL as 0 Description on Query:Columns: Display Hoursworked for 2005 Q4, four periods ago from Job Labor Fact tableRows: Display Employee Names on rows

NOTE: Use IIF function to display NULL as 0 (per spec) by replacing it with zero*/

WITH MEMBER [Measures].[2005 Q4] AS

IIF(([All Works Calendar].[FY Year Qtr].currentmember, [Measures].[Hoursworked]), ([All Works Calendar].[FY Year Qtr].currentmember, [Measures].[Hoursworked]),0)

MEMBER [Measures].[2004 Q4] AS

IIF(([Measures].[2005 Q4],PARALLELPERIOD([All Works Calendar].[FY Year Qtr].[Fy Qtr], 4)), ([Measures].[2005 Q4], PARALLELPERIOD([All Works Calendar].[FY Year Qtr].[Fy Qtr], 4)),0) SELECT{[Measures].[2004 Q4],[Measures].[2005 Q4] } ON COLUMNS,[Employees].[Full Name].children ON ROWSFROM [All Works]WHERE [All Works Calendar].[Fy Year Qtr].[2005].LASTCHILD

This query compares the hours by employee for a specific Year/Quarter, with the hours from 4 quarters previous using PARALLELPERIOD Function. Output on left.

2004 Q4 2005 Q4ANDREW TOLSON 0 225JOHNATHON NIXON 357 423.25KEN KOPENHAVER 325.5 395STEVEN WILSON 272.5 387

Page 13: May Woo Bi Portfolio

MDX SamplesMore MDX scripts: Sample uses different MDX function (LASTPERIODS) for desired results. Screen shot of output at

the bottom.

13May Woo Business Intelligence Portfolio2009

/*May WooThis MDX script displays the last two quarters of available data, to get allthe products in 'Action Figures' siblings list and get % of dollar sales forits "parent" product.*/WITH MEMBER [measures].[PctOfParent] AS[measures].[dollar sales]/([measures].[dollar sales],([product].[bycategory].PARENT)) ,FORMAT_STRING = 'percent'SELECT({ORDER(LASTPERIODS ( 2, [Time].[Quarter].LASTCHILD ), [Time].[Yqmd],ASC) }, {[measures].[dollar sales],[measures].[PctOfParent]}) ON COLUMNS,{[product].[action figures].SIBLINGS} ON ROWSFROM SalesWHERE [time].[2005]

Page 14: May Woo Bi Portfolio

MDX SamplesMDX script sample: using RANK, SET functions. Partial screen shot output at the bottom.

14May Woo Business Intelligence Portfolio2009

/*Classs Exercise (Chapter 6)RANK Cities by Dollar Sales, but only for those cities with an Average Price (Dollar Sales / Unit Sales) greater than $26.00 The WHERE clause will be for 2005 and the Product of Home Audio */WITHMEMBER [Measures].[Avg Sales Price] AS[Measures].[Dollar Sales] / [Measures].[Unit Sales], format_string = 'currency',SOLVE_ORDER = 10SET [OrderedCity] as ORDER(

Filter( [Customer].[city].children, [measures].[Avg Sales Price] > 26),[measures].[dollar sales], bdesc)

MEMBER [ProductRanking] as RANK( [Customer].[city].CurrentMember, [OrderedCity])SELECT { [Measures].[Dollar Sales], [ProductRanking],[measures].[Avg Sales Price] } on columns, [OrderedCity] on rowsFROM SALESWHERE ([Time].[2005], [product].[Home Audio])

Page 15: May Woo Bi Portfolio

Calculated Members

15May Woo Business Intelligence Portfolio2009

[Profit Pct]CASEWHEN ISEMPTY([Measures].[Total Profit] )

THEN NULLWHEN ([Measures].[Total Profit]) = 0

THEN 0WHEN [Measures].[Total Cost] = 0

THEN .15ELSE[Measures].[Total Profit]/ ([Measures].[Total Profit] + [Measures].[Total Cost])END

[Total Profit]([Measures].[Total Labor Profit] + [Measures].[Total Material Profit] + [Measures].[Additional Labor Profit])

[Total Cost]([Measures].[Total Labor Cost] +[Measures].[Total Material Cost] +[Measures].[Total Overhead])

Here are examples of Calculated Members that are in the cube. They can be used by Excel Services Pivot Tables, Reporting Services. These Calculated Members were Created To simplify KPI expressions.Screen shot example of one Calculated Member is Shown in BIDS interface below.

Page 16: May Woo Bi Portfolio

KPI’s, and Excel Services - SamplesExample – KPI Overhead Percent IncreaseKPI Overhead Percent Increase as: ([Measures].[Overhead Previous Quarter] -[Measures].[Overhead Current Quarter]) / [Measures].[Overhead Previous Quarter]

16May Woo Business Intelligence Portfolio2009

This KPI was written so different levels of the KPI Indicators would be expressed as multiples of the goal. This allows a change to only one place should the goal/target change. This KPI determines % of increase in Profit is Total Profit divided by Total Cost plus Total Profit. If greater than 15% is good, if greater than 5% and less than or equal to 15% is warning and less than or equal to 5% is bad.

Page 17: May Woo Bi Portfolio

KPI’s, Excel Services - SamplesExcel Services was used to connect to the Analysis Services Cubes, and used the Pivot Table

interface to create reports KPIs.First screen shot is KPI’s for Profit Percentage. If KPIProfitPct column is greater than 15% then

green light, if greater than 5%, less than or equal to 15% is yellow light and less than or equal to 5% is red light.

Second screen shot is KPI’s for Open Receivables. This report shows clients, their invoice amount, and the amount received. (if > 10% show Red, between 5% and 10% show Yellow, less than 5% show Green).

17May Woo Business Intelligence Portfolio2009

Page 18: May Woo Bi Portfolio

SSRS – Reporting ServicesSSRS Report: This is a report that uses Cascading Parameters before running the report. The

components of the report follow (top screen shot shows preview of the report, bottom screen shot shows layout of the report)

18May Woo Business Intelligence Portfolio2009

Page 19: May Woo Bi Portfolio

SSRS – Reporting ServicesBuilding the ReportScreen Shot 1: Shows Data Tab designer where manual MDX was inserted into a dataset to get

required output.

Screen Shot 2: Layout Tab where IIF function is used to show Pct change increase in Red( if current Qtr $ > prior Qtr $), also using IIF if no $ in prior Qtr, show % increase as 100%.

19May Woo Business Intelligence Portfolio2009

Page 20: May Woo Bi Portfolio

SSRS – Reporting ServicesPreview Page in SSRS (result from previous page Layout Tab). User can request any quarter from the drop down list, and the

report displays the quarter and previous quarter. Then this report is deployed to SharePoint to schedule to run on certain time of the day/week as a web page in the GeneratedReports Document Library.

The insert of this screen shot shows project properties to direct the output of this SSRS report to target data source report and URL site where the report will be displayed as web page in SharePoint.

20May Woo Business Intelligence Portfolio2009

Page 21: May Woo Bi Portfolio

MOSS/PPS – Share Point and Performance Point Services

Share Point was used to deploy reports through a Web Page. These reports below were created in Reporting Services (SSRS), Excel Services, and Performance Point. In addition, some of these same reports then import to Performance Point to create dashboards and scorecards.

Scorecard created in PPS: left scorecard shows KPI Overhead Trend for all clients ; Right scorecards show client financial and construction job financial, and further drill down to open receivables of % of invoiced with clients who have scorecards, and for profit % and overhead as % of total cost list all the clients.

PPS Dashboard for Overhead dollar amount and category description (chart can be run for multiple overhead categories)

21May Woo Business Intelligence Portfolio2009

Page 22: May Woo Bi Portfolio

MOSS/PPS – Share Point and Performance Point Services

22May Woo Business Intelligence Portfolio2009

Basic Overhead by Dates Chart – Created in Excel, then created PPS report using Excel Services, and published to Share Point (filter on year and show all quarter for that year)

Job Profitability Chart – Created in Excel (create a pivot table filter on multiple counties, then create pivot chart) and set the profit % as a dual-Y axis).

Page 23: May Woo Bi Portfolio

MOSS/PPS – Share Point and Performance Point Services

PPS Dashboard Design Page: (screen shows Query Tab where custom MDX was created to show the top chart of the bottom screen shot below).

Employee Labor Analysis Charts – created in PPS (top shows employee’s labor dollars by quarter, along with % of labor for the jobs the employee worked on, bottom shows % of labor dollars by project)

23May Woo Business Intelligence Portfolio2009

Page 24: May Woo Bi Portfolio

MOSS/PPS – Share Point and Performance Point Services

Excel Services Chart deployed through PPS with Parameters (multiple selections on both filters)

SSRS Report – Parameter Selection (filter on employee, date range to show hours work and total labor for each week end date)

24May Woo Business Intelligence Portfolio2009

Page 25: May Woo Bi Portfolio

MOSS/PPS – Share Point and Performance Point Services

SSRS Report that is generated automatic shared schedule every morning in Share Point.

Screen Shots of final team project (below and following page)

25May Woo Business Intelligence Portfolio2009

Page 26: May Woo Bi Portfolio

MOSS/PPS – Share Point and Performance Point Services

Final Team Project – more screen shots below

Data Model Design

26May Woo Business Intelligence Portfolio2009