Business Intelligence PortfolioRobert N. [email protected]
ContentsThis portfolio contains examples of my skills in the Business Intelligence arena.
Data Modeling 3
SQL Programming 6
SQL Server Integration Services (SSIS) 10
SQL Server Analysis Services (SSAS) 14
MDX Programming 19
SQL Server Reporting Services (SSRS) 22
Excel Power Pivot 24
Performance Point Services (PPS) 26
SharePoint Services 30
SQL and MDX Presentations 36
Experience Summary 37
Recommendations 38
D A T A M O D E L I N G
3
AllWorks Data WarehouseA data warehouse model must consider both the available data and reporting
needs to be supported.
4
Data Modeling Alternatives
Even a small data warehouse might have alternate designs that need to be tested for support of the needs of SSAS or SSRS development.
5
S Q L P R O G R A M M I N G
6
A Table Value FunctionThe function returns a product and the price as of a give date.
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetStandardCostByDate]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))DROP FUNCTION [dbo].[GetStandardCostByDate]GO
CREATE FUNCTION dbo.GetStandardCostByDate(@ProdNum NVARCHAR(25), @CostDate AS DATETIME)
RETURNS TABLEASRETURN
SELECT PP.ProductID, PP.ProductNumber, PP.Name, ROUND(PCH.StandardCost,2) AS RoundedStandCostFROM Production.ProductCostHistory PCHJOIN Production.Product PP ON PCH.ProductID = PP.ProductIDWHERE StartDate < DATEADD(DAY,1,@CostDate) AND PP.ProductNumber = @ProdNum AND ( PCH.EndDate is null OR PCH.EndDate >= @CostDate )
GO
The function can be used to return the price for a single item,
DECLARE @ProdNum NVARCHAR(25) = 'BK-R89R-58‘ , @CostDate DATETIME = '1/1/2008'
SELECT * FROM dbo.GetStandardCostByDate (@ProdNum,@CostDate)
. . . or it could be used to return a list based on addition selection criteria.
SELECT GET.ProductNumber , GET.Name , GET.RoundedStandCostFROM Production.Product PPCROSS APPLY dbo.GetStandardCostByDate (PP.ProductNumber, GETDATE()) GETWHERE GET.RoundedStandCost >= 1500ORDER BY GET.RoundedStandCost DESC
Both uses are potentially valuable in .NET and web based applications.
7
A Pivot Table with Dense Rank Query Pivot tables can be produced in many of the BI layers beginning with SQL. This example provides output that is useful in reporting and applications.
;WITH SaleByShipper AS( SELECT DATEADD(DAY, 7 - DATEPART(WEEKDAY,OrderDate),OrderDate) AS WeekEnding
, ShipMethodID, SUM(TotalDue) AS ShipperTotal
FROM Purchasing.PurchaseOrderHeader POHWHERE YEAR(DATEADD(DAY, 7 - DATEPART(WEEKDAY,OrderDate),OrderDate)) = 2007GROUP BY DATEADD(DAY, 7 - DATEPART(WEEKDAY,OrderDate),OrderDate)
, ShipMethodID)
SELECT WeekEnding, [1] AS XRQ, [2] AS ZY , [3] AS OVERSEAS , [4] AS OVERNIGHT , [5] AS CARGO
INTO #PivotFROM SaleByShipper
PIVOT ( SUM(ShipperTotal) FOR ShipMethodID IN ([1], [2], [3], [4], [5])) AS ShipDol
SELECT TOP 5 REPLACE(CONVERT(CHAR(10),WeekEnding,111),'/','-') AS WeekEnding, ISNULL(XRQ,0) + ISNULL(ZY,0) + ISNULL(OVERSEAS,0) +
ISNULL(OVERNIGHT,0) + ISNULL(CARGO,0) AS GrandTotal, DENSE_RANK() OVER (ORDER BY ISNULL(XRQ,0) + ISNULL(ZY,0) +
ISNULL(OVERSEAS,0) + ISNULL(OVERNIGHT,0) + ISNULL(CARGO,0) DESC) AS [Rank], XRQ, ZY , OVERSEAS , OVERNIGHT , CARGO
FROM #Pivot
8
Segments of a Stored ProcedureProducing a dual ranked output that has application uses for reporting.
SELECT * INTO #VendorFROM( SELECT
VEN.BusinessEntityID,
VEN.Name AS VendorName,
DENSE_RANK() OVER (ORDER BY SUM(TotalDue) DESC) AS VendorRank
,SUM(POH.TotalDue) AS TotalDueFROM
Purchasing.Vendor VENJOINPurchasing.PurchaseOrderHeader POH
ONPOH.VendorID =
VEN.BusinessEntityIDWHERE POH.OrderDate>= @StartDate
ANDPOH.OrderDate <
DATEADD(DAY,1,@EndDate)GROUP BY
VEN.BusinessEntityID,
VEN.Name) vendaliasWHERE VendorRank <= @TopVend
In a stored procedure
a temporary table built using a sub-query to build a Vendor Ranking,
and a similar query on Products
are joined in a final query
to provide a combined ranked listing of vendors and products.
EXEC dbo.TopProductForTopVendorSales@TopVend = 3, @TopProd =
3, @StartDate = '1/1/2007', @EndDate = '6/30/2008'
GO
SELECTV.VendorName
,V.VendorRank
,V.TotalDue
,P.ProductName
,P.ProductRank
,P.ProductTotalDue
FROM#Vendor V
JOIN#Product PONP.VendorID = V.BusinessEntityID
ORDER BY V.VendorRank,
P.ProductRank
9
S Q L S E R V E R I N T E G R A T I O N S E R V I C E S( S S I S )
10
The AllWorks Construction Company
The first step was the creation of the relational database using SQL.
This was followed by the development of an ETL process using SQL Server Integration Services.
The process was deployed to SQL Server Agent.
The deployed SSIS process is designed to do an initial load of the data as well as to be used for regular, ongoing processing of data.
The source included files from Excel, CSV and XML.
A series of real world projects are undertaken for a fictional construction firm. After creation of the database, an SQL Server Integration Services package was created to process the data.
11
Processing Employee Time RecordsThis process is used for the initial load of time records, but designed for scheduled processing that can be done daily or at any selected frequency. The process validates Projects and Employees and produces a single report of invalid records. Records that pass validation are checked for late time and a separate late time report is produced. Only records passing all three tests are inserted, and reports are sent by e-mail for invalid records and late time. Multiple source files are received and processed in a ForEach Loop in Control Flow.
Control Flow
Data Flow
12
Master ETL Control Flow A Master Control Flow was used to assure that the file processing order was sequenced to process primary keys before use of the primary key as a foreign key. The process began with control tables and ended with secondary transaction tables. Once processing is complete, database maintenance tasks are done in a final step.
13
S Q L S E R V E R A N A L Y S I S S E R V I C E S( S S A S )
14
Browsing the All Works Cube DataThe AllWorks OLTP database was staged to provide the OLAP cube shown here in the browser.
One of the features of the cube is the ability to click on a county and open a map centered on the county.
15
Creating A Staging Area for OLAP Deployment
;WITH EndDateCTE AS(SELECT DISTINCT [dbo].[WeekEndingDate](JobClosedDate) AS Dates FROM dbo.JobMasterUNIONSELECT DISTINCT [dbo].[WeekEndingDate](WorkDate) FROM dbo.JobTimeSheetsUNIONSELECT DISTINCT [dbo].[WeekEndingDate](PurchaseDate)FROM dbo.JobMaterialPurchasesUNIONSELECT [dbo].[WeekEndingDate]('Oct 2, 2004') -- DEFAULT JobCloseDate)INSERT INTO [AllWorksDW].[dbo].[DimDate]SELECT dbo.WeekEndingKey(Dates)
, CONVERT(VARCHAR(12),Dates, 107), CAST(CAST(YEAR(Dates) as varchar(4)) + CAST(DATEPART(qq,Dates) as varchar(1)) AS INT), 'Q' + CAST(DATEPART(Q,Dates) as varchar(1)) + '-' + CAST(YEAR(Dates) as varchar(4)) , YEAR(Dates)
FROM EndDateCTE WHERE Dates > '12/31/2003'
CREATE FUNCTION [dbo].[WeekEndingDate] ( @InputDate date ) -- 9-20-2010 RETURNS Date ASBEGIN DECLARE @ReturnDate DATE SET @ReturnDate = dateadd(day, ( @@DateFirst - datepart(weekday,@InputDate)), @InputDate)RETURN @ReturnDateENDGO
A copy of the OLTP Database was loaded to AllWorksDW and T-SQL Programs were used to create and load Fact and Dimension tables.
Fact and Dimensions were created using a combination of:
Views and
Tables created in Stored Procedures
This query creates a function to find the week ending date. A similar function to find the week ending key was also created.
This query was used in a Stored Procedure to create the Date Dimension.
16
Developing A CubeThe AllWorksOLAP cube build included basic structure, dimension usage, calculated members and sets, KPI’s, Actions, Partitions, Aggregations, and Perspectives.
17
A Calculated Member and KPI Definition
18
M D X P R O G R A M M I N G
19
Useful Simple MDX Queries
WITH SET [Weeks] ASFILTER ([Dates].[Calendar Tree].[Weekend], [Overhead Cost] <> null)
MEMBER [MovingXWeekAvg] ASAVG ( LastPeriods ( 52, [Dates].[Calendar
Tree].CurrentMember), ([Overhead Cost]))
SELECT {[Overhead Cost],[MovingXWeekAvg]} ON COLUMNS,[Weeks] ON ROWS
FROM [Overhead]
A query producing a weekly moving average.
WITHMEMBER [Labor Hrs Last Year] AS
( [Worked Hours] , parallelperiod ( [Dates].[Calendar Tree].[Quarter]
, 4
, [Dates].[Calendar Tree].CurrentMember
)) , FORMAT_STRING = 'Standard'
SELECT [Dates].[Quarter] * { [Worked Hours], [Labor Hrs Last Year] } on columns, NON EMPTY [Labor].[Employee Name].Children on rows
from [Labor]WHERE [Dates].[Calendar Tree].[Q4-2005]
Some really simply queries produce interesting, useful results, like this TOPPERCENT query:SELECT [Invoice Amount] on COLUMNS,
TOPPERCENT ([Projects].[Project].children, 30, [Invoice Amount]) ON ROWSFROM [Global]
Comparing this year to last year
20
A More Complex MDX ExampleWITH MEMBER [Internet Sales Amount Prior PD] as ( [Internet Sales Amount] , [Date].[Calendar].PrevMember) , format_string = ‘currency' MEMBER [% Sales Change] AS IIF ( [Internet Sales Amount Prior PD] <> null
, ([Internet Sales Amount] - [Internet Sales Amount Prior PD])
/ [Internet Sales Amount Prior PD], 0)
, format_string = 'percent'
SET [TopMonth] ASTOPCOUNT ( [Date].[Calendar].[Month], 3, [% Sales Change] )
MEMBER [MonthRank] ASRANK ( [Date].[Calendar].CurrentMember, [TopMonth] )
SET [Top3MonthsTop3Cities] ASGENERATE( [TopMonth], ( [Date].[Calendar].CurrentMember,
TOPCOUNT([Customer].[City].Children, 3, [% Sales Change]) ) )
MEMBER [CityRank] asRANK( ( [Date].[Calendar].CurrentMember, [Customer].
[City].CurrentMember), EXISTS( [Top3MonthsTop3Cities], [Date].[Calendar].CurrentMember))
SELECT {[Internet Sales Amount] , [Internet Sales Amount Prior PD],[% Sales Change], [MonthRank], [CityRank] }ON COLUMNS,[Top3MonthsTop3Cities]
ON ROWSFROM [Adventure Works]
This much more complex example calculates the percentage increase in sales over the prior month.
It identifies the months having the greatest increase and ranks these.
It evaluates cities within each of these months for sales increases and ranks those.
Finally the query reports the top 3 months and top 3 cities within those month and reports
the amount of sales for the month and prior month,
the percentage increase,
the ranking of the months, and
the ranking of the cities within those months.
21
S Q L S E R V E R R E P O R T I N G S E R V I C E S( S S R S )
22
Example Reports Developed in SSRS
Employee Sales: Actually is a master report with 4 sub reports.
Promotional Sales: A simple report requiring custom MDX.
The SSRS Project developed reports for deployment in SharePoint.
Sales by state with an accompanying chart of the top 10 states by either sales or returns.
23
E X C E L P O W E R P I V O T R E P O R T
24
Excel Power Pivot Against Contoso Operation Cube
Gridlines and headings are turned of to provide a cleaner appearance when deployed to SharePoint.
Product Category is configured to highlight and preselect valid subcategories.
Geography is based on a hierarchy from the cube, so can be expanded to lower levels.
25
P E R F O R M A N C E P O I N T S E R V I C E S ( P P S ) I N S H A R E P O I N T 2 0 1 0
26
Performance Point Services
Reports were prepared directly in PPS, and reports deployed to SharePoint from SSRS and Excel where brought into SharePoint to be deployed to the Dashboard.
For SSRS reports, the deployment to the Dashboard via PPS enabled the use of superior drop down and tree selections for report parameters.
27
Contoso Retail Scorecard Using SSAS KPIs
KPIs for the Contoso SSAS Operation Cube are used to build a scorecard. Indicators are modified to provide a better web appearance.
When building the Dashboard Page containing the KPIs, the primary KPIs are linked to a different chart that will appear in SharePoint when that KPI is selected. 28
Other PPS Reports
Other Charts and Reports are created directly in PPS.
The Excel Pivot Report is added so that it will be included on the Dashboard.
SSRS Reports are added and deployed to the SharePoint Dashboard using PPS page controls. This not only allows inclusion on the Dashboard, but also enables these reports to use SharePoint selection controls which have a better appearance and are easier to use.
29
S H A R E P O I N T S E R V I C E S
30
Welcome to the SharePoint Contoso Retail Dashboard
31
KPI Scorecard in SharePoint Dashboard
Product Gross Margin selected in KPI.
Returns % selected in KPI.
Channel Revenue selected in KPI.
Machine Downtime Trend selected in KPI.
The right hand chart is set by the select KPI on the left.
32
A Deceptively Simple Chart from PPS
But it has impressive drill down capabilities.
33
Other Dashboard Reports
34
SSRS Scheduled Reports
A simple informational report was created in SSRS, deployed in SharePoint, then versions for Maryland and Virginia were set up for daily production.
35
Demonstration and Educational PresentationsThese presentations, prepared independently, provide education and demonstrations
for anyone interest in T-SQL and MDX query syntax and use. The completed presentations are posted on LinkedIn as SlideShare Presentations.
36
Experience Summary
Over 12 years experience as a analyst, data auditor and T-SQL Programmer for data and financial system implementation and maintenance
Prior experience in accounting and system specification, selection and implementation
MS Business Intelligence
T-SQL Programming
SQL Server Integration Services (SSIS)
SQL Server Analysis Services (SSAS)
MDX Programming
SQL Server Reporting Services (SSRS)
Excel, Excel Services and Power Pivot
SharePoint for Business Intelligence
Performance Point Services (PPS)
37
RecommendationsLetter of Recommendation
Robert Litsinger The following is a letter of reference/recommendation for Robert Litsinger. Robert was enrolled in the SetFocus SQL Server Business Intelligence Master’s Program in the third quarter of 2011 and will graduate on October 21, 2011. I was Robert’s instructor throughout the 12-week program.
Robert brought substantial experience (25+ years) into the Master’s Program, with a background as a systems analyst, database professional, and management consultant. Robert demonstrated very early in our Master’s Program that he “knows data”. His prior work on data conversions in particular came through during many lecture discussions.
Robert performed very well in our Master’s Program curriculum, both during lecture and project weeks. He picked up a great deal of information, performed well on all areas of the BI stack, and often worked on lab assignments in the evenings/weekends after a long day of class. His attention to detail is exactly what every professional instructor hopes to see. The road to learning the Microsoft BI stack is paved with countless details: Robert demonstrated he can integrate them into his thought processes. During our final student team project, we will select Robert as the team lead.
Robert is very intelligent and articulate, and can translate business requirements into results. He has decades of experience in this area that a company will value. He also constructed some documentation of his own as part of the learning curve for MDX programming – several of his ideas were so good that I plan to utilize them for the next class.
Having been a hiring manager, I know that companies are equally concerned about the character of an applicant. Without any exaggeration, Robert is a model of professionalism, especially during periods of adversity. A company will benefit from his experience, capabilities, and work ethic - and will also appreciate his steady demeanor and common sense. He is a quality person who produces quality work. I enjoyed having him in class and appreciated his insights.
I would recommend Robert without hesitation for any SQL Server Business Intelligence developer/management position. Please contact me at [email protected], if you have any additional questions.
Kevin S. Goff | [email protected] SQL Server MVPSetFocus SQL Server Business Intelligence Practice Manager
About SetFocus: SetFocus, LLC (www.setfocus.com) is a Microsoft Certified Gold Partner for Learning Solutions. The Master's Program consists of intensive coverage of T-SQL, SSIS, SSAS, MDX, SSRS, PerformancePoint Server, SharePoint, and Excel Services. Our BI curriculum is one of the most intensive curriculums in the industry. The projects are based on actual project specifications from industry SQL Server and OLAP/Business Intelligence applications.
38