SlideShare a Scribd company logo
1 of 10
Download to read offline
Analysis Services Introduction. Creating OLAP cube
Analysis Services Introduction. Creating OLAP cube
This article show you, how to create data warehouse: database, dimensions, measures and OLAP
cube.

1. Creating a Database
1. Create car_transactions database. Open SQL Server Management Studio and execute the
command
CREATE DATABASE car_transactions;

2. Swich to car_transacion database and create a few table

use car_transactions;
CREATE TABLE Categories
(
CatId

INT IDENTITY(1,1) PRIMARY KEY,

Category VARCHAR(50),
);

Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube
CREATE TABLE Countries
(
CountryId INT IDENTITY(1,1) PRIMARY KEY,
Country

VARCHAR(55),

);
CREATE TABLE Cities
(
CityId

INT IDENTITY(1,1) PRIMARY KEY,

CountryId INT FOREIGN KEY REFERENCES Countries(CountryId),
City

VARCHAR(33),

);
CREATE TABLE Customers
(
CustId

INT IDENTITY(1,1) PRIMARY KEY,

CityId

INT FOREIGN KEY REFERENCES Cities(CityId),

Surname VARCHAR(15),
Name

VARCHAR(15),

);
CREATE TABLE Salesmen
(
SalesmanId INT IDENTITY(1,1) PRIMARY KEY,
Surname

VARCHAR(15),

Name

VARCHAR(15),

EmpDate

DATETIME,

BossId

INT,

);
CREATE TABLE Company
(
CompanyId INT IDENTITY(1,1) PRIMARY KEY,
CityId

INT FOREIGN KEY REFERENCES Cities(CityId),

Company

VARCHAR(33),

);
CREATE TABLE Cars
(

Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube
CarId

INT IDENTITY(1,1) PRIMARY KEY,

CategoryId INT FOREIGN KEY REFERENCES Categories(CatId),
CompanyId

INT FOREIGN KEY REFERENCES Company(CompanyId),

Car

VARCHAR(50),

Model

VARCHAR(50)

);
CREATE TABLE Transactions_facts_table
(
CarId

INT FOREIGN KEY REFERENCES Cars(CarId),

CustomerId INT FOREIGN KEY REFERENCES Customers(CustId),
SalesmanId INT FOREIGN KEY REFERENCES Salesmen(SalesmanId),
SalesDate

DATETIME,

Price

MONEY,

Amount

INT,

Value

MONEY

);

2. Insert a few records
Open SQL Server Management Studio and execute the script.
INSERT INTO Categories (Category) VALUES ('Hatchback');
INSERT INTO Categories (Category) VALUES ('Sedan');
INSERT INTO Categories (Category) VALUES ('Coupe');
INSERT INTO Categories (Category) VALUES ('Convertible');
INSERT INTO Categories (Category) VALUES ('Wagon');
INSERT INTO Categories (Category) VALUES ('SUV');
INSERT INTO Countries (Country) VALUES ('Germany');
INSERT INTO Countries (Country) VALUES ('USA');
INSERT INTO Countries (Country) VALUES ('Japan');
INSERT INTO Countries (Country) VALUES ('UK');
INSERT INTO Countries (Country) VALUES ('South Korea');
INSERT INTO Countries (Country) VALUES ('Italy');
INSERT INTO Cities (CountryId, City) VALUES (1,'Stuttgart');
INSERT INTO Cities (CountryId, City) VALUES (1,'Munich');

Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube
INSERT INTO Cities (CountryId, City) VALUES (2,'Dearborn');
INSERT INTO Cities (CountryId, City) VALUES (2,'Warren');
INSERT INTO Cities (CountryId, City) VALUES (3,'Toyota');
INSERT INTO Cities (CountryId, City) VALUES (3,'Fuchu');
INSERT INTO Cities (CountryId, City) VALUES (4,'Gaydon');
INSERT INTO Cities (CountryId, City) VALUES (4,'Crewe');
INSERT INTO Cities (CountryId, City) VALUES (4,'Whitley');
INSERT INTO Cities (CountryId, City) VALUES (5,'Seoul');
INSERT INTO Cities (CountryId, City) VALUES (6,'Maranello');
INSERT INTO Cities (CountryId, City) VALUES (6,'Modena');
INSERT INTO Company (CityId, Company) VALUES (1,'Mercedes-Benz');
INSERT INTO Company (CityId, Company) VALUES (2,'Bayerische Motoren Werke AG');
INSERT INTO Company (CityId, Company) VALUES (3,'Lincoln');
INSERT INTO Company (CityId, Company) VALUES (4,'Cadillac');
INSERT INTO Company (CityId, Company) VALUES (5,'Toyota Motor Corporation');
INSERT INTO Company (CityId, Company) VALUES (6,'Mazda Motor Corporation');
INSERT INTO Company (CityId, Company) VALUES (7,'Aston Martin Lagonda Limited');
INSERT INTO Company (CityId, Company) VALUES (8,'Bentley Motors Limited');
INSERT INTO Company (CityId, Company) VALUES (9,'Jaguar Cars Ltd');
INSERT INTO Company (CityId, Company) VALUES (10,'Kia Motors');
INSERT INTO Company (CityId, Company) VALUES (10,'Hyundai Motor Company');
INSERT INTO Company (CityId, Company) VALUES (11,'Ferrari S.p.A.');
INSERT INTO Company (CityId, Company) VALUES (12,'Maserati');
INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (1, 1, 'Mercedes-Benz',
'A-Class');
INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (1, 1, 'Mercedes-Benz',
'B-Class');
INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (2, 1, 'Mercedes-Benz',
'C-Class');
– (….)
INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (4, 12, 'Ferrari',
'California');
INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (2, 13, 'Maserati',
'Quattroporte');
INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (3, 13, 'Maserati',
'GranTurismo');
INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Smith', 'John', '2002-0504', NULL);
INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Johnson', 'Mark', '2002-

Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube
06-01', 1);
INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Kolarov', 'Steve', '200206-10', 1);
INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Williams', 'Michael',
'2003-10-01', 1);
INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Cronenberg', 'Will',
'2004-03-01', 1);
INSERT INTO Customers (CityId, Name, Surname) VALUES (1, 'Joshua', 'Brown');
INSERT INTO Customers (CityId, Name, Surname) VALUES (2, 'Jan', 'Davis');
INSERT INTO Customers (CityId, Name, Surname) VALUES (3, 'Willam', 'Novicki');
--(...)
INSERT INTO Customers (CityId, Name, Surname) VALUES (3, 'Daniel', 'Williams');
INSERT INTO Customers (CityId, Name, Surname) VALUES (4, 'Jan', 'Cote');
INSERT INTO Customers (CityId, Name, Surname) VALUES (5, 'Ethan', 'Taylor');
INSERT INTO Transactions_facts_table (CarId, CustomerId, SalesmanId, SalesDate, Price,
Amount, Value) VALUES (1, 1, 1, '2010-05-29', 30000, 1, 30000);
INSERT INTO Transactions_facts_table (CarId, CustomerId, SalesmanId, SalesDate, Price,
Amount, Value) VALUES (2, 2, 2, '2010-05-29', 35000, 1, 35000);
--(....)
INSERT INTO Transactions_facts_table (CarId, CustomerId, SalesmanId, SalesDate, Price,
Amount, Value) VALUES (70, 3, 1, '2011-12-22', 250000, 1, 250000);

3. Create a user
1. Open SQL Server Management Studio.
2. In Object Explorer, right-click the Logins folder and select New Login.
3. Type login name.
4. Select SQL Server authentification.
5. Type and confirm password.
6. Our password is simply. We clear Enforce password policy option.
7. Select default database.

Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube

8. Click Server Roles.tab and Select the appropriate role.
9. Click OK.

4. Creating an Analysis Services Project
1. On the Microsoft Windows task bar, click Start, point to All Programs, expand the Microsoft
SQL Server xxxx folder, and then select SQL Server Business Intelligence Development
Studio.
2. On the File menu, point to New and then select Project.
3. Name your project. The text in the Solution Name box changes automatically to match the
project name.
4. If you want select Create Directory for Solution and change the solution name
5. Click OK to create the project.
Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube
Watch, how to create an Analysis Services Project. Visit:
http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free

5. Creating a Data Source
The first task in creating an Analysis Services project is to create a data source. The data source
contains the information that Analysis Services uses to connect to the source database. It contains
the data provider name, the server and database name, and the authentication credentials that
Analysis Services will use.
1. In BIDS in Solution Explorer, right-click the Data Sources folder and select New Data
Source. The Data Source Wizard appears.
2. On the Welcome page, click Next.
3. On the Select How To Define The Connection page, click the New button. The Connection
Manager dialog box appears.
4. Type a server name: localhost.
5. In the Select Or Enter A Database Name list box, select car_transactions
6. Click Test Connection. A dialog box opens with the message “Test connection succeeded.”
Click OK.
7. Click OK to close the Connection Manager dialog box.
8. In the Data Source Wizard, on the Select How To Define The Connection page, click Next.
9. On the Impersonation Information page, select Use The Service Account and click Next.
10. Click Finish to complete the wizard.
Now that you have created a data source, you are ready to create a data source view.
Watch, how to create a Data Source. Visit:
http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free

6. Creating a Data Source View
A data source view is a logical data model that exists between your physical source database and
Analysis Services dimensions and cubes. When you create a data source view, you designate the
tables and views in the source database that contain data that you want to use to build dimensions
and cubes.
1. In Solution Explorer, right-click the Data Source Views folder and select New Data Source
View. The Data Source View Wizard appears.
2. On the Welcome page, click Next.
3. On the Select a Data Source page, select the car_transactions relational data source and click
Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube
Next.
4. Select dimensions and facts tables and then click Add Related Tables and Click Next. Accept
the default name and click Finish.
5. The Data Source View designer appears, displaying the tables you selected
Watch, how to create a Data Source View. Visit:
http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free

7. Creating dimesnions
Creating a customer dimension
1. In Solution Explorer, right-click the Dimensions folder and select New Dimension.
2. On the Welcome to the Dimension Wizard page, click Next.
3. Verify that Use An Existing Table is selected and click Next.
4. Select Customers from the Main Table list.
5. Select Surname from the Name Column list and then click Next.
6. Verify that the Cities and Countries tables are selected and click Next.
7. From the Available Attributes list, select all atributies and click Next.
8. On the Completing The Wizard page, type dimension name and click Finish.
9. Drag the Country attribute from the Attributes pane and drop to Hierarchies pane.
10. Drag the City and Cust ID attribute from the Attributes pane and drop it on <new level>.
11. In the Hierarchies pane, right-click the new hierarchy header and select Rename. Type
Country Customers Hierarchy and press Enter.
12. In Object Explorer, right-click the Customers dimension, and select Process. Then click Yes.
13. In the Process Dimension dialog box, click Run.
14. In the Process Progress dialog box, click Close. Now that the Customers dimension has been
builded.
15. You can preview the dimension - click Browser tab.
Create another dimension: salsmen, cars and time.
Watch, how to create all dimensions. Visit:
http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free
Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube
8. Creating a cube
1. In Solution Explorer, right-click the Cubes folder and select New Cube.
2. On the Welcome To The Cube Wizard page, click Next.
3. Verify that Use Existing Tables is selected and click Next.
4. In the Measure Group Tables list, select the Transactions_facts_table and click Next.
5. The Select Measures page lists the measure groups and measures that the wizard will create.
Click Next.
6. On the Select Existing Dimensions page, verify that the Customers, Cars and Salesmen
dimensions are selected. Click Next.
7. On the Completing The Wizard page, type the name of the cube and click Finish.
8. The Cube Designer appears, displaying the structure of the Car transactions cube.
9. In the Dimensions, right-click and select Add Cube Dimension.
10. In the Add Cube Dimension, select Time and click OK.
11. In the Cube Designer, click the Dimension Usage tab.
12. Select the cell in the grid at the intersection of the Time dimension and the Transactions Cars
Facts measure group. Click the ellipsis button. Choose Regular type. Choose Date.
13. Create the relationship between Date column (Time dimension) and SalesDate column (facts
table). Choose SalesDate.
14. In Solution Explorer, right-click the Car Transactions cube and select Process Cube.
15. Click Run to process cube.
16. Select Browser tab to preview cube.
Watch, how to create a cube. Visit:
http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free

Lear more, visit: http://www.learn-with-video-tutorials.com
Analysis Services Introduction. Creating OLAP cube

Lear more, visit: http://www.learn-with-video-tutorials.com

More Related Content

Viewers also liked

SSAS, MDX , Cube understanding, Browsing and Tools information
SSAS, MDX , Cube understanding, Browsing and Tools information SSAS, MDX , Cube understanding, Browsing and Tools information
SSAS, MDX , Cube understanding, Browsing and Tools information Vishal Pawar
 
DATA MART APPROCHES TO ARCHITECTURE
DATA MART APPROCHES TO ARCHITECTUREDATA MART APPROCHES TO ARCHITECTURE
DATA MART APPROCHES TO ARCHITECTURESachin Batham
 
Microsoft SQL Server Analysis Services (SSAS) - A Practical Introduction
Microsoft SQL Server Analysis Services (SSAS) - A Practical Introduction Microsoft SQL Server Analysis Services (SSAS) - A Practical Introduction
Microsoft SQL Server Analysis Services (SSAS) - A Practical Introduction Mark Ginnebaugh
 
data warehouse , data mart, etl
data warehouse , data mart, etldata warehouse , data mart, etl
data warehouse , data mart, etlAashish Rathod
 
Using the right data model in a data mart
Using the right data model in a data martUsing the right data model in a data mart
Using the right data model in a data martDavid Walker
 
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSEOLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSEZalpa Rathod
 

Viewers also liked (12)

SSAS, MDX , Cube understanding, Browsing and Tools information
SSAS, MDX , Cube understanding, Browsing and Tools information SSAS, MDX , Cube understanding, Browsing and Tools information
SSAS, MDX , Cube understanding, Browsing and Tools information
 
DATA MART APPROCHES TO ARCHITECTURE
DATA MART APPROCHES TO ARCHITECTUREDATA MART APPROCHES TO ARCHITECTURE
DATA MART APPROCHES TO ARCHITECTURE
 
Microsoft SQL Server Analysis Services (SSAS) - A Practical Introduction
Microsoft SQL Server Analysis Services (SSAS) - A Practical Introduction Microsoft SQL Server Analysis Services (SSAS) - A Practical Introduction
Microsoft SQL Server Analysis Services (SSAS) - A Practical Introduction
 
OLTP vs OLAP
OLTP vs OLAPOLTP vs OLAP
OLTP vs OLAP
 
data warehouse , data mart, etl
data warehouse , data mart, etldata warehouse , data mart, etl
data warehouse , data mart, etl
 
Using the right data model in a data mart
Using the right data model in a data martUsing the right data model in a data mart
Using the right data model in a data mart
 
Oltp vs olap
Oltp vs olapOltp vs olap
Oltp vs olap
 
Data mart
Data martData mart
Data mart
 
OLAP
OLAPOLAP
OLAP
 
Data mart
Data martData mart
Data mart
 
OLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSEOLAP & DATA WAREHOUSE
OLAP & DATA WAREHOUSE
 
Data mart
Data martData mart
Data mart
 

Recently uploaded

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 

Recently uploaded (20)

Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 

SQL Server Analysis Services - creating an OLAP cube.

  • 1. Analysis Services Introduction. Creating OLAP cube Analysis Services Introduction. Creating OLAP cube This article show you, how to create data warehouse: database, dimensions, measures and OLAP cube. 1. Creating a Database 1. Create car_transactions database. Open SQL Server Management Studio and execute the command CREATE DATABASE car_transactions; 2. Swich to car_transacion database and create a few table use car_transactions; CREATE TABLE Categories ( CatId INT IDENTITY(1,1) PRIMARY KEY, Category VARCHAR(50), ); Lear more, visit: http://www.learn-with-video-tutorials.com
  • 2. Analysis Services Introduction. Creating OLAP cube CREATE TABLE Countries ( CountryId INT IDENTITY(1,1) PRIMARY KEY, Country VARCHAR(55), ); CREATE TABLE Cities ( CityId INT IDENTITY(1,1) PRIMARY KEY, CountryId INT FOREIGN KEY REFERENCES Countries(CountryId), City VARCHAR(33), ); CREATE TABLE Customers ( CustId INT IDENTITY(1,1) PRIMARY KEY, CityId INT FOREIGN KEY REFERENCES Cities(CityId), Surname VARCHAR(15), Name VARCHAR(15), ); CREATE TABLE Salesmen ( SalesmanId INT IDENTITY(1,1) PRIMARY KEY, Surname VARCHAR(15), Name VARCHAR(15), EmpDate DATETIME, BossId INT, ); CREATE TABLE Company ( CompanyId INT IDENTITY(1,1) PRIMARY KEY, CityId INT FOREIGN KEY REFERENCES Cities(CityId), Company VARCHAR(33), ); CREATE TABLE Cars ( Lear more, visit: http://www.learn-with-video-tutorials.com
  • 3. Analysis Services Introduction. Creating OLAP cube CarId INT IDENTITY(1,1) PRIMARY KEY, CategoryId INT FOREIGN KEY REFERENCES Categories(CatId), CompanyId INT FOREIGN KEY REFERENCES Company(CompanyId), Car VARCHAR(50), Model VARCHAR(50) ); CREATE TABLE Transactions_facts_table ( CarId INT FOREIGN KEY REFERENCES Cars(CarId), CustomerId INT FOREIGN KEY REFERENCES Customers(CustId), SalesmanId INT FOREIGN KEY REFERENCES Salesmen(SalesmanId), SalesDate DATETIME, Price MONEY, Amount INT, Value MONEY ); 2. Insert a few records Open SQL Server Management Studio and execute the script. INSERT INTO Categories (Category) VALUES ('Hatchback'); INSERT INTO Categories (Category) VALUES ('Sedan'); INSERT INTO Categories (Category) VALUES ('Coupe'); INSERT INTO Categories (Category) VALUES ('Convertible'); INSERT INTO Categories (Category) VALUES ('Wagon'); INSERT INTO Categories (Category) VALUES ('SUV'); INSERT INTO Countries (Country) VALUES ('Germany'); INSERT INTO Countries (Country) VALUES ('USA'); INSERT INTO Countries (Country) VALUES ('Japan'); INSERT INTO Countries (Country) VALUES ('UK'); INSERT INTO Countries (Country) VALUES ('South Korea'); INSERT INTO Countries (Country) VALUES ('Italy'); INSERT INTO Cities (CountryId, City) VALUES (1,'Stuttgart'); INSERT INTO Cities (CountryId, City) VALUES (1,'Munich'); Lear more, visit: http://www.learn-with-video-tutorials.com
  • 4. Analysis Services Introduction. Creating OLAP cube INSERT INTO Cities (CountryId, City) VALUES (2,'Dearborn'); INSERT INTO Cities (CountryId, City) VALUES (2,'Warren'); INSERT INTO Cities (CountryId, City) VALUES (3,'Toyota'); INSERT INTO Cities (CountryId, City) VALUES (3,'Fuchu'); INSERT INTO Cities (CountryId, City) VALUES (4,'Gaydon'); INSERT INTO Cities (CountryId, City) VALUES (4,'Crewe'); INSERT INTO Cities (CountryId, City) VALUES (4,'Whitley'); INSERT INTO Cities (CountryId, City) VALUES (5,'Seoul'); INSERT INTO Cities (CountryId, City) VALUES (6,'Maranello'); INSERT INTO Cities (CountryId, City) VALUES (6,'Modena'); INSERT INTO Company (CityId, Company) VALUES (1,'Mercedes-Benz'); INSERT INTO Company (CityId, Company) VALUES (2,'Bayerische Motoren Werke AG'); INSERT INTO Company (CityId, Company) VALUES (3,'Lincoln'); INSERT INTO Company (CityId, Company) VALUES (4,'Cadillac'); INSERT INTO Company (CityId, Company) VALUES (5,'Toyota Motor Corporation'); INSERT INTO Company (CityId, Company) VALUES (6,'Mazda Motor Corporation'); INSERT INTO Company (CityId, Company) VALUES (7,'Aston Martin Lagonda Limited'); INSERT INTO Company (CityId, Company) VALUES (8,'Bentley Motors Limited'); INSERT INTO Company (CityId, Company) VALUES (9,'Jaguar Cars Ltd'); INSERT INTO Company (CityId, Company) VALUES (10,'Kia Motors'); INSERT INTO Company (CityId, Company) VALUES (10,'Hyundai Motor Company'); INSERT INTO Company (CityId, Company) VALUES (11,'Ferrari S.p.A.'); INSERT INTO Company (CityId, Company) VALUES (12,'Maserati'); INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (1, 1, 'Mercedes-Benz', 'A-Class'); INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (1, 1, 'Mercedes-Benz', 'B-Class'); INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (2, 1, 'Mercedes-Benz', 'C-Class'); – (….) INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (4, 12, 'Ferrari', 'California'); INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (2, 13, 'Maserati', 'Quattroporte'); INSERT INTO Cars (CategoryId, CompanyId, Car, Model) VALUES (3, 13, 'Maserati', 'GranTurismo'); INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Smith', 'John', '2002-0504', NULL); INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Johnson', 'Mark', '2002- Lear more, visit: http://www.learn-with-video-tutorials.com
  • 5. Analysis Services Introduction. Creating OLAP cube 06-01', 1); INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Kolarov', 'Steve', '200206-10', 1); INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Williams', 'Michael', '2003-10-01', 1); INSERT INTO Salesmen (Surname, Name, EmpDate, BossId) VALUES ('Cronenberg', 'Will', '2004-03-01', 1); INSERT INTO Customers (CityId, Name, Surname) VALUES (1, 'Joshua', 'Brown'); INSERT INTO Customers (CityId, Name, Surname) VALUES (2, 'Jan', 'Davis'); INSERT INTO Customers (CityId, Name, Surname) VALUES (3, 'Willam', 'Novicki'); --(...) INSERT INTO Customers (CityId, Name, Surname) VALUES (3, 'Daniel', 'Williams'); INSERT INTO Customers (CityId, Name, Surname) VALUES (4, 'Jan', 'Cote'); INSERT INTO Customers (CityId, Name, Surname) VALUES (5, 'Ethan', 'Taylor'); INSERT INTO Transactions_facts_table (CarId, CustomerId, SalesmanId, SalesDate, Price, Amount, Value) VALUES (1, 1, 1, '2010-05-29', 30000, 1, 30000); INSERT INTO Transactions_facts_table (CarId, CustomerId, SalesmanId, SalesDate, Price, Amount, Value) VALUES (2, 2, 2, '2010-05-29', 35000, 1, 35000); --(....) INSERT INTO Transactions_facts_table (CarId, CustomerId, SalesmanId, SalesDate, Price, Amount, Value) VALUES (70, 3, 1, '2011-12-22', 250000, 1, 250000); 3. Create a user 1. Open SQL Server Management Studio. 2. In Object Explorer, right-click the Logins folder and select New Login. 3. Type login name. 4. Select SQL Server authentification. 5. Type and confirm password. 6. Our password is simply. We clear Enforce password policy option. 7. Select default database. Lear more, visit: http://www.learn-with-video-tutorials.com
  • 6. Analysis Services Introduction. Creating OLAP cube 8. Click Server Roles.tab and Select the appropriate role. 9. Click OK. 4. Creating an Analysis Services Project 1. On the Microsoft Windows task bar, click Start, point to All Programs, expand the Microsoft SQL Server xxxx folder, and then select SQL Server Business Intelligence Development Studio. 2. On the File menu, point to New and then select Project. 3. Name your project. The text in the Solution Name box changes automatically to match the project name. 4. If you want select Create Directory for Solution and change the solution name 5. Click OK to create the project. Lear more, visit: http://www.learn-with-video-tutorials.com
  • 7. Analysis Services Introduction. Creating OLAP cube Watch, how to create an Analysis Services Project. Visit: http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free 5. Creating a Data Source The first task in creating an Analysis Services project is to create a data source. The data source contains the information that Analysis Services uses to connect to the source database. It contains the data provider name, the server and database name, and the authentication credentials that Analysis Services will use. 1. In BIDS in Solution Explorer, right-click the Data Sources folder and select New Data Source. The Data Source Wizard appears. 2. On the Welcome page, click Next. 3. On the Select How To Define The Connection page, click the New button. The Connection Manager dialog box appears. 4. Type a server name: localhost. 5. In the Select Or Enter A Database Name list box, select car_transactions 6. Click Test Connection. A dialog box opens with the message “Test connection succeeded.” Click OK. 7. Click OK to close the Connection Manager dialog box. 8. In the Data Source Wizard, on the Select How To Define The Connection page, click Next. 9. On the Impersonation Information page, select Use The Service Account and click Next. 10. Click Finish to complete the wizard. Now that you have created a data source, you are ready to create a data source view. Watch, how to create a Data Source. Visit: http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free 6. Creating a Data Source View A data source view is a logical data model that exists between your physical source database and Analysis Services dimensions and cubes. When you create a data source view, you designate the tables and views in the source database that contain data that you want to use to build dimensions and cubes. 1. In Solution Explorer, right-click the Data Source Views folder and select New Data Source View. The Data Source View Wizard appears. 2. On the Welcome page, click Next. 3. On the Select a Data Source page, select the car_transactions relational data source and click Lear more, visit: http://www.learn-with-video-tutorials.com
  • 8. Analysis Services Introduction. Creating OLAP cube Next. 4. Select dimensions and facts tables and then click Add Related Tables and Click Next. Accept the default name and click Finish. 5. The Data Source View designer appears, displaying the tables you selected Watch, how to create a Data Source View. Visit: http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free 7. Creating dimesnions Creating a customer dimension 1. In Solution Explorer, right-click the Dimensions folder and select New Dimension. 2. On the Welcome to the Dimension Wizard page, click Next. 3. Verify that Use An Existing Table is selected and click Next. 4. Select Customers from the Main Table list. 5. Select Surname from the Name Column list and then click Next. 6. Verify that the Cities and Countries tables are selected and click Next. 7. From the Available Attributes list, select all atributies and click Next. 8. On the Completing The Wizard page, type dimension name and click Finish. 9. Drag the Country attribute from the Attributes pane and drop to Hierarchies pane. 10. Drag the City and Cust ID attribute from the Attributes pane and drop it on <new level>. 11. In the Hierarchies pane, right-click the new hierarchy header and select Rename. Type Country Customers Hierarchy and press Enter. 12. In Object Explorer, right-click the Customers dimension, and select Process. Then click Yes. 13. In the Process Dimension dialog box, click Run. 14. In the Process Progress dialog box, click Close. Now that the Customers dimension has been builded. 15. You can preview the dimension - click Browser tab. Create another dimension: salsmen, cars and time. Watch, how to create all dimensions. Visit: http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free Lear more, visit: http://www.learn-with-video-tutorials.com
  • 9. Analysis Services Introduction. Creating OLAP cube 8. Creating a cube 1. In Solution Explorer, right-click the Cubes folder and select New Cube. 2. On the Welcome To The Cube Wizard page, click Next. 3. Verify that Use Existing Tables is selected and click Next. 4. In the Measure Group Tables list, select the Transactions_facts_table and click Next. 5. The Select Measures page lists the measure groups and measures that the wizard will create. Click Next. 6. On the Select Existing Dimensions page, verify that the Customers, Cars and Salesmen dimensions are selected. Click Next. 7. On the Completing The Wizard page, type the name of the cube and click Finish. 8. The Cube Designer appears, displaying the structure of the Car transactions cube. 9. In the Dimensions, right-click and select Add Cube Dimension. 10. In the Add Cube Dimension, select Time and click OK. 11. In the Cube Designer, click the Dimension Usage tab. 12. Select the cell in the grid at the intersection of the Time dimension and the Transactions Cars Facts measure group. Click the ellipsis button. Choose Regular type. Choose Date. 13. Create the relationship between Date column (Time dimension) and SalesDate column (facts table). Choose SalesDate. 14. In Solution Explorer, right-click the Car Transactions cube and select Process Cube. 15. Click Run to process cube. 16. Select Browser tab to preview cube. Watch, how to create a cube. Visit: http://www.learn-with-video-tutorials.com/analysis-services-video-tutorial-free Lear more, visit: http://www.learn-with-video-tutorials.com
  • 10. Analysis Services Introduction. Creating OLAP cube Lear more, visit: http://www.learn-with-video-tutorials.com