SQL01 - Introduction To Business Intelligence
SQL01 - Introduction To Business Intelligence
Business Intelligence
Prem Shanker
Sr. Software Engineer
Credit Suisse
Goals
• Learn about the concept of Data Warehousing and what
BIDS offer.
• Learn about how to design and implement a Data
Warehouse Dimensional database.
• Learn about what is a cube.
• Learn about the SQL Server Analysis Services
Architecture
• Learn what is new in Analysis Services 2008
• Learn about what is a MDX Language.
What BIDS can do?
Cubes
Source
Systems/OLTP
Clients
SQL Server Analysis
Data Services
Query Tools
Warehouse
Reporting
Analysis
1 2 3 4
Design the Populate Create Query
Data Warehouse Data Warehouse OLAP Cubes D
Data Warehouse
• Table and Cube
• Star Schema and Snowflake Schema
• Fact Table and Dimension Table
Table vs Cube
A simplified example:
A typical relational Make it into a cube
table
Data are organized by rows Data are organized by intersections
Milk West 4
Total 4 6 10
Product dim
The basic ingredients
to make a cube
• Two kinds of table in a data warehouse DB
1. fact table
2. dimension tables.
• Question:
1. Which one is a fact table and which one is a
dimension table?
Star Schema
• A Star Schema contains a fact table and one or
more dimension tables.
1. A Fact Table: The central fact table store the
numeric fact (measures) such as Sales dollars,
Costs, Unit Sales etc.
2. Dimension Tables: They surround the central
fact table, and they store descriptive
information about the measures
• The shape looks like a Star
Star schema
Snowflake Schema
Review: Data
Warehouse Schemas
– The Data Warehouse is either a Star Schema or a
Snowflake Schema:
• Fact tables that contain foreign keys and numeric measures
• Dimension table contains the data describes the measures.
Excel
OLEDB
TCP ADOMD
Client
Apps
Analysis
XMLA
Server MOSS
IIS
AMO
BIDS
HTTP
SSMS
ADOMD SSRS
.NET
A Logical Cube -
Example
Product
Donut
Sandwich
Region
The Milk
Sales$ by North
Soda by South
Soda
West in Yr East
of 2001
Beer West
West
1999 2000 2001 2002 Time
Tools to connect to
Cubes
• SQL Server Management Studio (SSMS)
• Business Intelligence Development Studio (BIDS)
• Query Analyzer (SSMS) – To write MDX
• Excel 2007 – Uses MDX
Physical Cube- BIDS
• Analysis Services Database
• Unified Dimensional Model
• Data Source connection
• Data Source View
• Dimensions
• Cube Creation Wizard
Analysis Services Database
• An Analysis Services database is the top level
container for other dependent objects:
• A database includes
– Data Source
– Data Source View
– Cube
– Dimension
– Security Role
Creating an Analysis
Services Database
• You can use one of the following to create a new
empty database on an instance of SQL Server
2005 Analysis Services.
– SQL Server Management Studio
– Business Intelligence Development Studio.
Unified Dimensional
Modeling
• Common Name: UDM
• New feature Since AS 2005
• Combine all Relational Sources in one
single environment.
• A single data model, called Unified
Dimensional Model (UDM) over one or
more physical data sources
Unified Dimensional
Model - Concept
• The user needs to understand the particulars of
each technology (e.g. the dialect of SQL used) to
generate reports.
• Within one single Analysis Services, you can have
more than one data sources to pull the data from.
Data Source
Connection
• The data sources of your AS database is your Data
Warehouse databases (SQL).
• It defines the connection string and authentication
information for a database on an OLE DB data provider.
• You can use the Data Source Wizard to specify one or
more data sources (SQLDB) for Analysis Services
databases.
The Functions of the
Data Sources
• Integrate your Analysis Services databases with
the data warehouses
• They are used for the following:
– Processing the Cubes and dimensions
– Data Retrieval if ROLAP or HOLAP is used as the
storage.
– Write Back
Different Storage
types of Cube
Data Sources
connection to SQL
Server
• For SQL Server, you can pick from the following providers:
– OLE DB provider for SQL Server
– SQL Native Client
– .NET Provider/SqlClient Data Provider
Select
on axis (x),
on axis (y),
on axis (z)
From [cubeName]
Every cell has a
name...
c ts Components
du Clothing
r o Bikes
P
1997
1998
Time
1999
2000
2001
s t
Sale Cos Unit
s Measures
Every cell has a
name...
(Products.Bikes, Measures.Units, Time.[2000])
c ts Components
du Clothing
o
Pr Bikes
1997
1998
Time
1999
2000
2001
s t
Sale Cos Unit
s Measures
Every cell has a
name...
(Products.Bikes, Measures.Units, Time.[2000])
(Products.Bikes, Measures.Sales, Time.[1999])
c ts Components
du Clothing
o
Pr Bikes
1997
1998
Time
1999
2000
2001
s t
Sale Cos Unit
s Measures
A Cell is referenced by all the
dimensions
c ts Components
du Clothing
o
Pr Bikes 1997
1998
Time
1999
2000
2001
s t
Sale Cos Unit
s Measures
Default Member
What if I only specify this?
(Products.Bikes, Measures.Units)
If Time’s default member is [1997]
Ans: (Products.Bikes, Measures.Units, Time.[1997])
c ts Computer
d u Monitor
r o Printer
P
1997
1998
Time
1999
2000
2001
s t
Sale Cos Unit
s Measures
The Basic Elements of
an MDX Query
Select
{[Ship Date].[Calendar]} on columns,
{[Product].[Product Categories]} on rows
from [Adventure Works]
Using Braces { }
In AS 2000:
SELECT
{[Ship Date].[Calendar]} ON COLUMNS,
{[Product].[Product Categories]} ON ROWS
FROM [Adventure Works]
Using Brackets [ ]
Desired result:
Naming Additional
Dimensions
Number Name
AXIS(0) COLUMNS
AXIS(1) ROWS
AXIS(2) PAGES
AXIS(3) SECTIONS
AXIS(4) CHAPTERS
Retrieving Data from a
Cube
select
[Ship Date].[Calendar].[Calendar Year].[CY 2004] on axis(0),
[Promotion].[Promotions].[reseller] on axis(1)
from [Adventure Works]
[Promotion].[Promotions]
No Discunt
Reseller
select
[Ship Date].[Calendar].[Calendar Year].[CY 2004] on axis(0),
[Promotion].[Promotions].[reseller] on axis(1)
from [Adventure Works]
Expect Result
Fully Qualified Names
• [CY 2001] below could be
– [Delivery Date].[Calendar].[CY 2001] or
– [Ship Date].[Calendar].[CY 2001]
select
[CY 2001] on axis(0)
from [Adventure Works]
[Promotion].
[Promotions]
No
Discount
Resell
Components
er Clothing
[Product].
Bikes
200120022003 2004 [Product Categories
[Ship Date].[Calendar]
Demo
• www.microsoft.com/sqlserver/2008/en/us/analys
is-services.aspx
• All BI WebCasts -
http://www.microsoft.com/events/series/
bi.aspx?tab=webcasts&id=all
• MDX References –
msdn.microsoft.com/en-us/library/ms145506.aspx
Thank You
pundit.prem@gmail.com