SlideShare ist ein Scribd-Unternehmen logo
1 von 10
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Andere mochten auch

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
 

Andere mochten auch (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
 

Kürzlich hochgeladen

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Kürzlich hochgeladen (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

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