Table of Contents
Contents Page
Data Modeling 3
SQL Programming 6
SQL Server Integration Services (SSIS) 9
SQL Server Analysis Services (SSAS) 13
MDX Programming 20
SQL Server Reporting Services (SSRS) 24
MS Performance Point Server (PPS) 27
MS Office Excel Services 2007 31
MS Office SharePoint Server 2007 (MOSS) 34
This portfolio contains examples that were developed while participating in the SetFocus Microsoft Business Intelligence Masters Program.
DATA MODELING
Relational Physical Model of the database used in a team project. This database tracked evaluations submitted by students and was
used to build a series of charts and reports that allowed instructors to see how they were performing over a variety of metrics.
Data Model of a Star Schema used to create a staging area to import data for a project. This project was used to track book sales by author,
customer and region. Examples how it was used are found in the following section.
SQL PROGRAMMING
The queries in this section used the staging area shown in the previous section. This query returns all publishers with books that are currently out of stock, quantities still needed, and order status, ordered by greatest quantity needed first .
SELECT books.ISBN, title as [Book Title], PUBLISHER, QUANTITYORDERED-QUANTITYDISPATCHED AS [Quantity Needed], orders.orderid, case
when orderdate+3 < getdate() and quantityordered>quantitydispatchedthen '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, title, PUBLISHER, orderdate, orders.orderid, quantityordered,
quantitydispatchedorder by [quantity needed] desc
This query determines the list of countries from which orders have been placed, the number of orders and order items that have been had from each country, the percentages of the total orders, and the percentages of total order items received from each country--Create temporary table select
[Country], count(OrderNum) as [Total Orders], sum(QuantityOrdered) as [Total Items Ordered] into #C_Totals
from(select right(address, charindex(' ',reverse(address))-1) as 'Country', customers.customerID , orders.orderID as 'OrderNum', orderItems.orderItemID, case
when QuantityOrdered is nullthen 0else QuantityOrderedend as QuantityOrdered
from ordersinner join orderItems
on orders.orderID=orderItems.orderIDright join customers
on orders.customerID=customers.customerIDgroup by QuantityOrdered,
customers.customerID, address, orders.orderID, orderItems.OrderItemID
) as C_Ordersgroup by [Country] with rollup--Query temporary table to extract, calculate and format data appropriatelyselect [Country], [Total Orders], [Total Items Ordered], (convert(numeric(10,4),([Total Orders]/(select convert(numeric,[Total Orders]) from #C_Totals where [Country] is null)))*100) as [% of Total Orders] , (convert(numeric(10,4),([Total Items Ordered]/(select convert(numeric,[Total Items Ordered]) from #C_Totals where [Country] is null)))*100) as [% of Total Items Ordered] from #C_Totalswhere [Country] is not null group by [Country], [Total Orders], [Total Items Ordered] -- Should clean up afterwardsdrop table #C_Totals
SQL SERVER INTEGRATION SERVICES
(SSIS)
This is the data flow and control flow for the Job Time Sheets package. This package imports multiple csv files doing checks to insure data integrity and writing rows that fail to an error log file for review. This is just one part of a project that brought in the employee and customer data of a construction company. The data
structure created here was used in several subsequent BI projects.
This is the script that tracks how many records were processed for the Job Time Sheets package. It breaks them up into Inserted, Updated and Error categories. These totals are used in the email that is sent when processing is completed.
' Microsoft SQL Server Integration Services Script Task' Write scripts using Microsoft Visual Basic' The ScriptMain class is the entry point of the Script Task.
Imports SystemImports System.DataImports System.MathImports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMainPublic Sub Main() Dim InsertedRows As Integer = CInt(Dts.Variables("InsertedRows").Value) Dim ErrorRows As Integer = CInt(Dts.Variables("ErrorRows").Value) Dim RawDataRows As Integer = CInt(Dts.Variables("RawDataRows").Value) Dim UpdatedRows As Integer = CInt(Dts.Variables("UpdatedRows").Value) Dim InsertedRows_fel As Integer = CInt(Dts.Variables("InsertedRows_fel").Value) Dim ErrorRows_fel As Integer = CInt(Dts.Variables("ErrorRows_fel").Value) Dim RawDataRows_fel As Integer = CInt(Dts.Variables("RawDataRows_fel").Value) Dim UpdatedRows_fel As Integer = CInt(Dts.Variables("UpdatedRows_fel").Value)
Dts.Variables("InsertedRows").Value = InsertedRows + InsertedRows_fel Dts.Variables("ErrorRows").Value = ErrorRows + ErrorRows_fel Dts.Variables("RawDataRows").Value = RawDataRows + RawDataRows_fel Dts.Variables("UpdatedRows").Value = UpdatedRows + UpdatedRows_fel Dts.TaskResult = Dts.Results.Success
End Sub
End Class
This is the data flow of a package that merged data from multiple tables together in order to create a fact table for a cube. This fact table was the key fact table used in the final
BI project for our class.
SQL SERVER ANALYSIS SERVICES
(SSAS)
This section uses the staging area that was created in the SSIS section. Here the data is deployed from the staging area into
a cube and SSAS is used to create KPIs and Excel Reports.
The AllWorks database deployed as a cube using SSAS
Browsing the AllWorks data cube to make sure the data is organized in the desired manner for purposes in
which it will be used.
Creating Calculated Members for use in KPIs and Excel Reports
Creating Key Performance Indicators (KPIs) to show visually goals, trends
and changes in tracked metrics
Use of a KPI in Excel to show Profits against projected goals.
Partitioning the cube to separate archival data from more frequently accessed data. Also Aggregations were setup here to further enhance storage and query performance.
MDX PROGRAMMING
This section uses the AllWorks cube created in the last section. The code created here was used in created calculations for use in KPIS.
For 2005, show the job and the top three employees who worked the most hours. Show the jobs in job order, and within the job show the employees in hours worked order
SELECT[Measures].[Hoursworked]ON COLUMNS,non empty Order(Generate([Job Master].[Description].[Description].members,
([Job Master].[Description].currentmember,TOPCOUNT([Employees].[Full Name].[Full Name].members,3,[Measures].[Hoursworked]))),[Measures].[Hoursworked],DESC)
on rowsFROM AllworksWHERE[All Works Calendar].[Fy Year].&[2005]
Show Overhead by Overhead Category for currently selected quarter and the previous quarter, and also show the % of change between the two.
WITHMEMBER [Measures].[Previous Qtr] AS
([Measures].[Weekly Over Head],ParallelPeriod ([All Works Calendar].[Fy Year - Fy Qtr].level
,1,[All Works Calendar].[Fy Year - Fy Qtr].currentmember) ),FORMAT_STRING = '$#,##0.00;;;0‘
MEMBER [Measures].[Current Qtr] AS([Measures].[Weekly Over Head],[All Works Calendar].[Fy Year - Fy Qtr].currentmember),FORMAT_STRING = '$#,##0.00;;;0‘
MEMBER [Measures].[% Change] ASiif([Measures].[Previous Qtr], (([Measures].[Current Qtr] - [Measures].[Previous Qtr]) / [Measures].[Previous Qtr]),NULL),FORMAT_STRING = '0.00%;;;\N\/\A‘
SELECT{[Measures].[Current Qtr], [Measures].[Previous Qtr], [Measures].[% Change]}on columns,non empty [Overhead].[Description].memberson rowsFROM AllworksWHERE [All Works Calendar].[Fy Year - Fy Qtr].[2005].lastchild
List Hours Worked and Total Labor for each employee for 2005, along with the labor rate (Total labor / Hours worked). Sort the employees by labor rate descending, to see the employees with
the highest labor rate at the top.
WITHMEMBER [Measures].[Labor Rate] AS[Measures].[Total Labor]/[Measures].[Hoursworked],FORMAT_STRING = 'Currency'
SELECT{[Measures].[Hoursworked],[Measures].[Total Labor],[Measures].[Labor Rate]}ON COLUMNS,non empty Order([Employees].[Full Name].members,[Measures].[Labor Rate], BDESC)on rowsFROM AllworksWHERE[All Works Calendar].[Fy Year].&[2005]
SQL SERVER REPORTING SERVICES
(SSRS)
This report uses the AllWorks cube and shows an employees labor cost by weekending date with a grand total at the bottom.
Cascading parameters are used to select the employee and dates.
A report of region sales percentage by category for a selected year.
MS PERFORMANCE POINT SERVER (PPS)
A breakdown of the labor cost of an employee by quarter. The line graph shows the percentage of labor of the employee for the quarter. The chart at the bottom shows the breakdown by job.
These use the AllWorks cube created earlier.
The custom MDX code that allows the previous report to run
This scorecard has a drill down capability that will allow you to see regions, states and city Sales goals. In addition it is hot
linked to a report that shows Dollar Sales.
MS OFFICE EXCEL SEVICES 2007
This excel spreadsheet has taken data from a cube and created a chart. This chart and its parameter will then be published using Excel Services to make it available
on a Sharepoint server.
Another chart built using Excel with data from a cube. This chart allows the tracking of sales data by Category on a selected year. In addition it tracks the selected category percentage of sales vs. the parent on a separate axis. This chart with its parameters was
published to SharePoint Server using Excel Services.
MS OFFICE SHAREPOINT SERVER
(MOSS)
SharePoint site created with document folders to hold Excel spreadsheets published with Excel Services, SSRS reports, and Performance Point
Dashboards. Two web parts are on the front page showing a Excel chart and SSAS KPI published through Performance Point.
The previously shown Employee Labor Analysis Report deployed to SharePoiont as part of A Performance Point
Dashboard.
An SSRS reported scheduled to be autogenerated using SharePoint scheduling and subsription services
Excel spreadsheets and charts deployed to SharePoint using Excel Services.