SlideShare a Scribd company logo
Business Intelligence Portfolio Name: May Woo Email: [email_address] Phone: 253.520.6683 May Woo  Business Intelligence Portfolio 2009
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 May Woo  Business Intelligence Portfolio 2009
Project Overview Introduction:  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) May Woo  Business Intelligence Portfolio 2009
T-SQL Samples /* May Woo Using the UNION operator to combine result sets of separate queries */ SELECT a . state , a . member_no , count (*)   as  numkids FROM juvenile AS  j INNER   JOIN  adult AS  a ON  j . adult_member_no  =  a . member_no WHERE  a . state  =   'CA' GROUP   BY  a . member_no ,  a . state   Output from left query: HAVING   COUNT (*)   >  3 UNION SELECT a . state , a . member_no , count (*)   as  numkids FROM juvenile AS  j INNER   JOIN  adult AS  a ON  j . adult_member_no  =  a . member_no WHERE  a . state  =   'AZ' GROUP   BY  a . member_no ,  a . state HAVING   COUNT (*)   >  2   Output from left query: May Woo  Business Intelligence Portfolio 2009 state member_no numkids ----- --------- ----------- AZ  25  4 AZ  117  3 CA  95  4 CA  141  4 CA  187  4 /* May Woo This 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  AS t 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  197 5  Fall of the House of Usher  43  196 25  The Black Tulip  246  196 29  Misalliance  288  197 33  The First 100,000 Prime Numbers  330  196 4  Songs of a Savoyard  533  196 8  The Cherry Orchard  575  197 32  The Call of the Wild  820  196 41  Sense and Sensibility  904  196 (9 row(s) affected)
T-SQL Samples /* May Woo Combine columns to create full name */ SELECT   firstname + ' ' + isnull ( middleinitial + ' ' , '' )+ lastname  AS   'Name'   ,   Street ,   City ,   State ,   Zip FROM  dbo . member me INNER   JOIN  dbo . adult ad ON  me . member_no = ad . member_no ORDER   BY  lastname ,  firstname May Woo  Business Intelligence Portfolio 2009 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 Woo Query to declare and use variables in a SQL statement. */ use  JungleBooks declare  @txtLastFourDigits  char ( 4 ) set  @txtLastFourDigits  = '7889' select  CustomerID  as   'ID' ,  CardNumber  as   'Card Number' ,   left( ExpiryDate ,  11 )   as   'Expires' from  Customers where  CardNumber  like   '%'   +  @txtLastFourDigits order   by   'ID' ID  Card Number  Expires ----------- -------------------- ----------- 21  7898-3233-3223-7889  Jan 31 2002 (1 row(s) affected)
T-SQL Samples 2009 May Woo  Business Intelligence Portfolio /* May Woo Use 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 . isbn inner   join  orders  on  orderitems . orderid = orders . orderid WHERE  QUANTITYORDERED > QUANTITYDISPATCHED  and  stock = 0 GROUP 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 Review 097-972-0261  Lucerne Publishing 2 22 Needs Review 097-972-0261  Lucerne Publishing 2 23 Needs Review 097-972-0261  Lucerne Publishing 1 36 Needs Review 72-80081-024  New Moon Books 1 37 Needs Review 9-001-122-01  Binnet and Hardley 1 29 Needs Review 9-001-122-01  Binnet and Hardley 1 30 Needs Review 9-001-122-90  Binnet and Hardley 1 27 Needs Review 097-972-0261  Lucerne Publishing 1 20 Needs Review   (9 row(s) affected)
SSIS – Integration Services Integration 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 May Woo  Business Intelligence Portfolio 2009
SSIS – Integration Services 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.  May Woo  Business Intelligence Portfolio 2009
SSIS – Integration Services Creation 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. May Woo  Business Intelligence Portfolio 2009
SSAS – Analysis Services Design 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: May Woo  Business Intelligence Portfolio 2009
SSAS – Analysis Services Design 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: May Woo  Business Intelligence Portfolio 2009
MDX Samples The 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. May Woo  Business Intelligence Portfolio 2009 /* Name: May Woo Date: 08/21/2009 Company: SetFocus LLC Job Name: Job Labor Fact Query 04-05 Job 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 table Rows:   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   ROWS FROM  [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 Q4 ANDREW TOLSON 0 225 JOHNATHON NIXON 357 423.25 KEN KOPENHAVER 325.5 395 STEVEN WILSON 272.5 387
MDX Samples More MDX scripts:  Sample uses different MDX function (LASTPERIODS) for desired results.  Screen shot of output at the bottom. May Woo  Business Intelligence Portfolio 2009 /* May Woo This MDX script displays the last two quarters of available data, to get all the products in 'Action Figures' siblings list and get % of dollar sales for its &quot;parent&quot; 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   ROWS FROM  Sales WHERE  [time].[2005]
MDX Samples MDX script sample : using RANK, SET functions.  Partial screen shot output at the bottom. May Woo  Business Intelligence Portfolio 2009 /* 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  */ WITH MEMBER  [Measures].[Avg Sales Price]  AS [Measures].[Dollar Sales] / [Measures].[Unit Sales],  format_string  = 'currency', SOLVE_ORDER  = 10 SET  [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   rows FROM  SALES WHERE  ([Time].[2005], [product].[Home Audio])
Calculated Members [Profit Pct] CASE WHEN   ISEMPTY ([Measures].[Total Profit] ) THEN   NULL WHEN  ([Measures].[Total Profit]) = 0 THEN  0 WHEN  [Measures].[Total Cost] = 0 THEN  .15 ELSE [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]) May Woo  Business Intelligence Portfolio 2009 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.
KPI’s, and Excel Services - Samples Example – KPI Overhead Percent Increase KPI Overhead Percent Increase as: ([Measures].[Overhead Previous Quarter] - [Measures].[Overhead Current Quarter])  / [Measures].[Overhead Previous Quarter] May Woo  Business Intelligence Portfolio 2009 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.
KPI’s, Excel Services - Samples Excel 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). May Woo  Business Intelligence Portfolio 2009
SSRS – Reporting Services SSRS 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) May Woo  Business Intelligence Portfolio 2009
SSRS – Reporting Services Building the Report Screen 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%. May Woo  Business Intelligence Portfolio 2009
SSRS – Reporting Services Preview 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. May Woo  Business Intelligence Portfolio 2009
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) May Woo  Business Intelligence Portfolio 2009
MOSS/PPS – Share Point and Performance Point Services 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). May Woo  Business Intelligence Portfolio 2009
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) May Woo  Business Intelligence Portfolio 2009
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) May Woo  Business Intelligence Portfolio 2009
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) May Woo  Business Intelligence Portfolio 2009
MOSS/PPS – Share Point and Performance Point Services Final Team Project – more screen shots below Data Model Design May Woo  Business Intelligence Portfolio 2009

More Related Content

PDF
Partitioning tables and indexing them
PDF
Partitioning Tables and Indexing Them --- Article
PPT
Nunes database
PDF
Sq lite module7
PPT
Chap 7
PDF
CIS 336 Final Exam 2 (Devry)p
PPTX
Yui3.4.0 What's new
PDF
Database Design Project-Oracle 11g
Partitioning tables and indexing them
Partitioning Tables and Indexing Them --- Article
Nunes database
Sq lite module7
Chap 7
CIS 336 Final Exam 2 (Devry)p
Yui3.4.0 What's new
Database Design Project-Oracle 11g

Similar to May Woo Bi Portfolio (20)

DOCX
The ultimate-guide-to-sql
PPT
Kevin Bengtson Portfolio
PPTX
Business Intelligence Portfolio
PPTX
SQL Server 2008 Portfolio
PPT
James Colby Maddox Business Intellignece and Computer Science Portfolio
PPTX
Chris Seebacher Portfolio
PDF
Tufte Sample Bi Portfolio
PPTX
Beginers guide for oracle sql
PPT
Short Intro to PHP and MySQL
PPT
Sql Server 2000
PPT
Select To Order By
PPTX
Marcus Matthews
PPTX
Training on Microsoft SQL Server(older version).pptx
PDF
The ultimate-guide-to-sql
PPT
Greg Lewis SQL Portfolio
PPTX
Adv Topic -------Basic SQL_DML Session 2
PPTX
J. Adcock Bi Portfolio
PPT
Database Development Replication Security Maintenance Report
PPT
Chris Mc Glothen Sql Portfolio
PPT
SQL Server 2008 Portfolio for Saumya Bhatnagar
The ultimate-guide-to-sql
Kevin Bengtson Portfolio
Business Intelligence Portfolio
SQL Server 2008 Portfolio
James Colby Maddox Business Intellignece and Computer Science Portfolio
Chris Seebacher Portfolio
Tufte Sample Bi Portfolio
Beginers guide for oracle sql
Short Intro to PHP and MySQL
Sql Server 2000
Select To Order By
Marcus Matthews
Training on Microsoft SQL Server(older version).pptx
The ultimate-guide-to-sql
Greg Lewis SQL Portfolio
Adv Topic -------Basic SQL_DML Session 2
J. Adcock Bi Portfolio
Database Development Replication Security Maintenance Report
Chris Mc Glothen Sql Portfolio
SQL Server 2008 Portfolio for Saumya Bhatnagar
Ad

May Woo Bi Portfolio

  • 1. Business Intelligence Portfolio Name: May Woo Email: [email_address] Phone: 253.520.6683 May Woo Business Intelligence Portfolio 2009
  • 2. 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 May Woo Business Intelligence Portfolio 2009
  • 3. Project Overview Introduction: 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) May Woo Business Intelligence Portfolio 2009
  • 4. T-SQL Samples /* May Woo Using the UNION operator to combine result sets of separate queries */ SELECT a . state , a . member_no , count (*) as numkids FROM juvenile AS j INNER JOIN adult AS a ON j . adult_member_no = a . member_no WHERE a . state = 'CA' GROUP BY a . member_no , a . state Output from left query: HAVING COUNT (*) > 3 UNION SELECT a . state , a . member_no , count (*) as numkids FROM juvenile AS j INNER JOIN adult AS a ON j . adult_member_no = a . member_no WHERE a . state = 'AZ' GROUP BY a . member_no , a . state HAVING COUNT (*) > 2 Output from left query: May Woo Business Intelligence Portfolio 2009 state member_no numkids ----- --------- ----------- AZ 25 4 AZ 117 3 CA 95 4 CA 141 4 CA 187 4 /* May Woo This 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 AS t 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 197 5 Fall of the House of Usher 43 196 25 The Black Tulip 246 196 29 Misalliance 288 197 33 The First 100,000 Prime Numbers 330 196 4 Songs of a Savoyard 533 196 8 The Cherry Orchard 575 197 32 The Call of the Wild 820 196 41 Sense and Sensibility 904 196 (9 row(s) affected)
  • 5. T-SQL Samples /* May Woo Combine columns to create full name */ SELECT firstname + ' ' + isnull ( middleinitial + ' ' , '' )+ lastname AS 'Name' , Street , City , State , Zip FROM dbo . member me INNER JOIN dbo . adult ad ON me . member_no = ad . member_no ORDER BY lastname , firstname May Woo Business Intelligence Portfolio 2009 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 Woo Query to declare and use variables in a SQL statement. */ use JungleBooks declare @txtLastFourDigits char ( 4 ) set @txtLastFourDigits = '7889' select CustomerID as 'ID' , CardNumber as 'Card Number' , left( ExpiryDate , 11 ) as 'Expires' from Customers where CardNumber like '%' + @txtLastFourDigits order by 'ID' ID Card Number Expires ----------- -------------------- ----------- 21 7898-3233-3223-7889 Jan 31 2002 (1 row(s) affected)
  • 6. T-SQL Samples 2009 May Woo Business Intelligence Portfolio /* May Woo Use 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 . isbn inner join orders on orderitems . orderid = orders . orderid WHERE QUANTITYORDERED > QUANTITYDISPATCHED and stock = 0 GROUP 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 Review 097-972-0261 Lucerne Publishing 2 22 Needs Review 097-972-0261 Lucerne Publishing 2 23 Needs Review 097-972-0261 Lucerne Publishing 1 36 Needs Review 72-80081-024 New Moon Books 1 37 Needs Review 9-001-122-01 Binnet and Hardley 1 29 Needs Review 9-001-122-01 Binnet and Hardley 1 30 Needs Review 9-001-122-90 Binnet and Hardley 1 27 Needs Review 097-972-0261 Lucerne Publishing 1 20 Needs Review   (9 row(s) affected)
  • 7. SSIS – Integration Services Integration 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 May Woo Business Intelligence Portfolio 2009
  • 8. SSIS – Integration Services 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. May Woo Business Intelligence Portfolio 2009
  • 9. SSIS – Integration Services Creation 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. May Woo Business Intelligence Portfolio 2009
  • 10. SSAS – Analysis Services Design 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: May Woo Business Intelligence Portfolio 2009
  • 11. SSAS – Analysis Services Design 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: May Woo Business Intelligence Portfolio 2009
  • 12. MDX Samples The 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. May Woo Business Intelligence Portfolio 2009 /* Name: May Woo Date: 08/21/2009 Company: SetFocus LLC Job Name: Job Labor Fact Query 04-05 Job 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 table Rows: 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 ROWS FROM [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 Q4 ANDREW TOLSON 0 225 JOHNATHON NIXON 357 423.25 KEN KOPENHAVER 325.5 395 STEVEN WILSON 272.5 387
  • 13. MDX Samples More MDX scripts: Sample uses different MDX function (LASTPERIODS) for desired results. Screen shot of output at the bottom. May Woo Business Intelligence Portfolio 2009 /* May Woo This MDX script displays the last two quarters of available data, to get all the products in 'Action Figures' siblings list and get % of dollar sales for its &quot;parent&quot; 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 ROWS FROM Sales WHERE [time].[2005]
  • 14. MDX Samples MDX script sample : using RANK, SET functions. Partial screen shot output at the bottom. May Woo Business Intelligence Portfolio 2009 /* 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 */ WITH MEMBER [Measures].[Avg Sales Price] AS [Measures].[Dollar Sales] / [Measures].[Unit Sales], format_string = 'currency', SOLVE_ORDER = 10 SET [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 rows FROM SALES WHERE ([Time].[2005], [product].[Home Audio])
  • 15. Calculated Members [Profit Pct] CASE WHEN ISEMPTY ([Measures].[Total Profit] ) THEN NULL WHEN ([Measures].[Total Profit]) = 0 THEN 0 WHEN [Measures].[Total Cost] = 0 THEN .15 ELSE [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]) May Woo Business Intelligence Portfolio 2009 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.
  • 16. KPI’s, and Excel Services - Samples Example – KPI Overhead Percent Increase KPI Overhead Percent Increase as: ([Measures].[Overhead Previous Quarter] - [Measures].[Overhead Current Quarter]) / [Measures].[Overhead Previous Quarter] May Woo Business Intelligence Portfolio 2009 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.
  • 17. KPI’s, Excel Services - Samples Excel 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). May Woo Business Intelligence Portfolio 2009
  • 18. SSRS – Reporting Services SSRS 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) May Woo Business Intelligence Portfolio 2009
  • 19. SSRS – Reporting Services Building the Report Screen 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%. May Woo Business Intelligence Portfolio 2009
  • 20. SSRS – Reporting Services Preview 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. May Woo Business Intelligence Portfolio 2009
  • 21. 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) May Woo Business Intelligence Portfolio 2009
  • 22. MOSS/PPS – Share Point and Performance Point Services 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). May Woo Business Intelligence Portfolio 2009
  • 23. 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) May Woo Business Intelligence Portfolio 2009
  • 24. 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) May Woo Business Intelligence Portfolio 2009
  • 25. 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) May Woo Business Intelligence Portfolio 2009
  • 26. MOSS/PPS – Share Point and Performance Point Services Final Team Project – more screen shots below Data Model Design May Woo Business Intelligence Portfolio 2009