This document provides samples of code and projects related to Microsoft SQL Server business intelligence technologies including T-SQL, MDX, SSIS, SSAS, SSRS and SharePoint. It includes T-SQL code samples, an SSIS project overview, diagrams and explanations of an SSAS cube design, examples of KPIs and MDX queries, and summaries of using Excel and SSRS with SSAS data. The samples and projects are intended to demonstrate the author's skills and experience with various Microsoft BI technologies.
Database automated build and test - SQL In The City Cambridge
Tjeffriesppt Bi Portfolio
1. Timothy L. Jeffries 2009
Timothy L. Jeffries
tjeffries@charter.net
678-778-9672
1
2. Timothy L. Jeffries 2009
TABLE OF CONTENTS
Project Overviews
T-SQL Samples
MDX Samples
SSIS – Integration Services
SSAS – Analysis Services
Calculated Members
KPI’s, Trend Indicators, and Excel Services – Samples
SSRS- Reporting Services
MOSS/PPS – Share Point and Performance Point Services
2
3. Timothy L. Jeffries 2009
PROJECT OVERVIEW
Sample Business Intelligence Project Work
This portfolio contains selected code that I have developed in the Microsoft
Business Intelligence area.
Overall 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)
•
3
4. Timothy L. Jeffries 2009
PROJECT GOALS
Define a Star Schema database using Visio
•
Create a Staging Database (Visio generated script)
•
Create an ETL solution to update the SQL Server 2005 database from Excel and
•
flat files using SSIS
Create a Star Schema Analysis Services using SSAS
•
Write MDX queries bases on criteria lay outs
•
Define Calculated Members and business Key Performance Indicators (KPIs) 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)
•
4
12. Timothy L. Jeffries 2009
SSIS PROJECT
These containers update and insert records for the Employee and Client tables
while reading the information form either an excel or flat file. If any of these packets
fail and email is sent out and everything is rolled back stopping the process.
12
14. Timothy L. Jeffries 2009
SSIS PROJECT
Connected to the other two containers these containers continue the updates and
will send an email out once all the insert and updates are done. Then it does a
backup, shrink and index after everything is updated. Once the database
maintenance is finished then emails are send out. 14
15. Timothy L. Jeffries 2009
SSIS PROJECT
This is an example of an expression that sends out an email on success with
information about how the files in the package were processed and how many
failed, processed, and failed the conversion.
15
16. Timothy L. Jeffries 2009
SSIS PROJECT
This For each loop container will loop through all the files in the directory that is
specified and load all the files. The container is also programmed for error and
checks as seen below.
16
17. Timothy L. Jeffries 2009
SSIS PROJECT
In a nutshell this part of the project looks and converts the files to SQL format and
logs any errors. Then it looks up PK and put the ones not found into a file. Then it
checks the table to see if this is an insert or an update and then records how many
it does of each, all counts are running counts and are done in vb.net as shown
below.
17
18. Timothy L. Jeffries 2009
SSIS PROJECT
This is the setup so that we can pass in what we want to read in the script and then
what is coming back from the script. The script is explained below.
18
19. Timothy L. Jeffries 2009
SSIS PROJECT
This script runs every time what we process a file and then once the counts are
completed it copies the file to a done folder and deletes the other file. This is done
so we do not duplicate the files and so we do not lose them either.
19
20. Timothy L. Jeffries 2009
SSAS – ANALYSIS SERVICES
Design the Data Source View using BIDS
Create a cube in Adventure Works using fact tables and dimension tables
•
Create a star diagram using the fact tables and dimension, a snowflake diagram will have dimension tables connected to
•
other dimension tables.
This is the view prior to the cube being launched.
•
20
21. Timothy L. Jeffries 2009
SSAS – ANALYSIS SERVICES
Once the cube is created we now display the fact tables in yellow connected to the blue tables that are the dimensions.
This diagram shows all the fact tables pointing towards the PKs in the dimension tables.
This is an example of a snowflake diagram due to the points having multiple points on them.
A start diagram has on fact tables connected to dimension tables without dimension tables connected to them.
21
22. Timothy L. Jeffries 2009
SSAS – ANALYSIS SERVICES
After the cube is launched the wizard will build all the relationships and those that are not built must be done manually.
The tables in yellow are the fact tables and the ones in blue are the dimension tables.
All the fact tables have the FKs for the PKs in the dimension tables.
22
23. Timothy L. Jeffries 2009
SSAS – ANALYSIS SERVICES
Create reports in Excel using outside data and pivot tables.
23
24. Timothy L. Jeffries 2009
SSAS – ANALYSIS SERVICES
This will also let you filter, notice that the filter is set to all males for sales.
24
30. Timothy L. Jeffries 2009
MDX EXAMPLES
Simple MDX example that show MA, PA, and NY dollar and unit sales for Q1 and Q2
30
31. Timothy L. Jeffries 2009
MDX EXAMPLES
Displays the different level of Hierarchy levels staring with the first parent, then
second parent, then the tools level and then finally to the children of the tools for the
3 months in the 3rd quarter. 31
32. Timothy L. Jeffries 2009
MDX EXAMPLES
Uses a member to create a calculated member so we can see the difference in
Dollar Sale, Unit Sales, and Dollar Returns for the first two quarters.
32
33. Timothy L. Jeffries 2009
MDX EXAMPLES
Shows how to filter using the columns where the unit sales is greater in Q4, 2005 are
greater 1.4 times Q4, 2004 displaying the Dollar sales for Q4, 2005
33
34. Timothy L. Jeffries 2009
MDX EXAMPLES
Creates Avg Price, Max Avg Price, Price Range, and Min Avg Price then displays Q3
and Q4 and Cross joins that Calculated prices together for all the children of Home
Audio.
34