Upload
chinne046
View
57
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Create First OLAP Cube in SQL Server Analysis Services - CodeProject
Citation preview
Search for articles, questions, tips
home quick answers discussions features community helparticles
Articles » Database » Database » SQL Server
Mubin M. Shaikh, 21 Jul 2014 CPOL Rate this:
Create First OLAP Cube in SQL Server Analysis Services
Learn creation of OLAP Cube in SSAS (SQL Server Analysis Services) using Microsoft BIDS (Business Intelligence Development Studio)
Environment and Data Warehouse
Download SalesDataAnalysis.zip - 53.7 KB
Download Data_WareHouse__SQLScript.zip - 8.1 KB
Introduction
This article is created to help those technical newbies who want to learn creation of OLAP Cube in SSAS (SQL Server Analysis Services)
using Microsoft BIDS (Business Intelligence Development Studio) Environment and Data Warehouse. We will first take a glimpse at the
basic introduction to requirement of OLAP Cube, and then create OLAP Cube in SQL Server Analysis Service by following 10 easy steps.
Before preparing OLAP Cube, we need to create and populate our data warehouse. If you are totally new to Data Warehouse concepts,
please take a quick look at my previous article “Create First Data Warehouse” which can give you a brief idea on data warehouse
concepts which are used in this article.
Brief Introduction to OLAP Cube
What is OLAP Cube & Why do we need it?
An OLAP cube is a technology that stores data in an optimized way to provide a quick response to various types of complex
queries by using dimensions and measures.
Most cubes store pre-aggregates of the measures with its special storage structure to provide quick response to queries.
SSRS Reports and Excel Power Pivot is used as front end for Reporting and data analysis with SSAS (SQL Server Analysis Services)
OLAP Cube.
SSAS (SQL Server Analysis Services) is Microsoft BI Tool for creating Online Analytical Processing and data mining functionality.
BIDS (Business Intelligence Development Studio) provides environment for developing your OLAP Cube and Deploy on SQL
Server.
BIDS (Business Intelligence Development Studio) comes with Microsoft SQL Server 2005, 2008 (e.g. Developer, Enterprise Edition) .
We have to choose OLAP Cube when performance is a key factor, the key decision makers of the company can ask for statistics
from the data anytime from your huge database.
We can perform various types of analysis on data stored in Cube, it is also possible to create data mining structure on this data
which can be helpful in forecasting, prediction.
What is the difference between OLAP and OLTP?
Online Transaction Processing (OLTP) Online Analytical Processing (OLAP)
Designed to support Daily DML Operations of your applicationDesigned to hold historical data for analyses and forecast business
needs
Holds daily Latest Transactional Data related to your application Data is consistent up to the last update that occurred in your Cube
4.84 (199 votes)
×Sign up for our free weekly Web Developer Newsletter.
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
1 of 22 6/11/2015 1:02 AM
Online Transaction Processing (OLTP) Online Analytical Processing (OLAP)
Data stored in normalized format Data stored in denormalized format
Databases size is usually around 100 MB to 100 GB Databases size is usually around 100 GB to a few TB
Used by normal usersUsed by users who are associated with the decision making process,
e.g., Managers, CEO.
CPU, RAM, HDD space requirement is less. CPU, RAM, HDD space requirement is higher.
Query response may be slower if the amount of data is very
large, it can impact the reporting performance.
Query Response is quicker, management can do Trend analysis on
their data easily and generate quicker reports.
T-SQL language used for query MDX is used for querying on OLAP Cube
Basic Architecture
In our case, data warehouse is used as a source of data to Cube in BIDS. Once Cube gets ready with data, users can run queries on Cube
created in SSAS. SSRS Reports and Excel Pivoting/Power Pivot can use OLAP Cube as source of data instead of OLTP database to get
performance for resolving Complex Queries.
SSRS Reports, Excel Power Pivot can be used for visualization/analysis of data from cube.
Scenario
X-Mart is having different malls in our city, where daily sales take place for various products. Higher management is facing an issue while
decision making due to non availability of integrated data they can’t do study on their data as per their requirement. So they asked us to
design a system which can help them quickly in decision making and provide Return on Investment (ROI).
So as a part of the design, we had completed designing of First Data Warehouse in my previous article. Now we have to Design / Create
OLAP Cube in SSAS, on which our reports can do a quick query and we can also provide self service BI capability to users later on.
Creating Data Warehouse
Let us execute our T-SQL Script to create data warehouse with fact tables, dimensions and populate them with appropriate test values.
Download T-SQL script attached with this article for creation of Sales Data Warehouse or download from this article “Create First Data
Warehouse” and run it in your SQL Server.
Follow the given steps to run the query in SSMS (SQL Server Management Studio).
Open SQL Server Management Studio 20081.
Connect Database Engine2.
Open New Query editor3.
Copy paste Scripts given below in various steps in new query editor window one by one4.
To run the given SQL Script, press F55.
It will create and populate “Sales_DW” database on your SQL Server6.
Developing an OLAP Cube
For creation of OLAP Cube in Microsoft BIDS Environment, follow the 10 easy steps given below.
Step 1: Start BIDS Environment
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
2 of 22 6/11/2015 1:02 AM
Click on Start Menu -> Microsoft SQL Server 2008 R2 -> Click SQL Server Business Intelligence Development Studio.
Step 2: Start Analysis Services Project
Click File -> New -> Project ->Business Intelligence Projects ->select Analysis Services Project-> Assign Project Name -> Click OK
Step 3: Creating New Data Source
3.1 In Solution Explorer, Right click on Data Source -> Click New Data Source
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
3 of 22 6/11/2015 1:02 AM
3.2 Click on Next
3.3 Click on New Button
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
4 of 22 6/11/2015 1:02 AM
3.4 Creating New connection
Specify Your SQL Server Name where your Data Warehouse was created1.
Select Radio Button according to your SQL Server Authentication mode2.
Specify your Credentials using which you can connect to your SQL Server3.
Select database Sales_DW.4.
Click on Test Connection and verify for its success5.
Click OK.6.
3.5 Select Connection created in Data Connections-> Click Next
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
5 of 22 6/11/2015 1:02 AM
3.6 Select Option Inherit
3.7 Assign Data Source Name -> Click Finish
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
6 of 22 6/11/2015 1:02 AM
Step 4: Creating New Data Source View
4.1 In the Solution Explorer, Right Click on Data Source View -> Click on New Data Source View
4.2 Click Next
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
7 of 22 6/11/2015 1:02 AM
4.3 Select Relational Data Source we have created previously (Sales_DW)-> Click Next
4.4 First move your Fact Table to the right side to include in object list.
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
8 of 22 6/11/2015 1:02 AM
Select FactProductSales Table -> Click on Arrow Button to move the selected object to Right Pane.
4.5 Now to add dimensions which are related to your Fact Table, follow the given steps:
Select Fact Table in Right Pane (Fact product Sales) -> Click On Add Related Tables
4.6 It will add all associated dimensions to your Fact table as per relationship specified in your SQL DW (Sales_DW).
Click Next.
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
9 of 22 6/11/2015 1:02 AM
4.7 Assign Name (SalesDW DSV)-> Click Finish
4.8 Now Data Source View is ready to use.
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
10 of 22 6/11/2015 1:02 AM
Step 5: Creating New Cube
5.1 In Solution Explorer -> Right Click on Cube-> Click New Cube
5.2 Click Next
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
11 of 22 6/11/2015 1:02 AM
5.3 Select Option Use existing Tables -> Click Next
5.4 Select Fact Table Name from Measure Group Tables (FactProductSales) -> Click Next
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
12 of 22 6/11/2015 1:02 AM
5.5 Choose Measures from the List which you want to place in your Cube --> Click Next
5.6 Select All Dimensions here which are associated with your Fact Table-> Click Next
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
13 of 22 6/11/2015 1:02 AM
5.7 Assign Cube Name (SalesAnalyticalCube) -> Click Finish
5.8 Now your Cube is ready, you can see the newly created cube and dimensions added in your solution explorer.
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
14 of 22 6/11/2015 1:02 AM
Step 6: Dimension Modification
In Solution Explorer, double click on dimension Dim Product -> Drag and Drop Product Name from Table in Data Source View and Add
in Attribute Pane at left side.
Step 7: Creating Attribute Hierarchy In Date Dimension
Double click On Dim Date dimension -> Drag and Drop Fields from Table shown in Data Source View to Attributes-> Drag and Drop
attributes from leftmost pane of attributes to middle pane of Hierarchy.
Drag fields in sequence from Attributes to Hierarchy window (Year, Quarter Name, Month Name, Week of the Month, Full Date UK),
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
15 of 22 6/11/2015 1:02 AM
Step 8: Deploy the Cube
8.1 In Solution Explorer, right click on Project Name (SalesDataAnalysis) -- > Click Properties
8.2 Set Deployment Properties First
In Configuration Properties, Select Deployment-> Assign Your SQL Server Instance Name Where Analysis Services Is Installed (mubin-
pc\fairy) (Machine Name\Instance Name) -> Choose Deployment Mode Deploy All as of now ->Select Processing Option Do Not
Process -> Click OK
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
16 of 22 6/11/2015 1:02 AM
8.3 In Solution Explorer, right click on Project Name (SalesDataAnalysis) -- > Click Deploy
8.4 Once Deployment will finish, you can see the message Deployment Completed in deployment Properties.
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
17 of 22 6/11/2015 1:02 AM
Step 9: Process the Cube
9.1 In Solution Explorer, right click on Project Name (SalesDataAnalysis) -- > Click Process
9.2 Click on Run button to process the Cube
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
18 of 22 6/11/2015 1:02 AM
9.3 Once processing is complete, you can see Status as Process Succeeded -->Click Close to close both the open windows for
processing one after the other.
Step 10: Browse the Cube for Analysis
10.1 In Solution Explorer, right click on Cube Name (SalesDataAnalysisCube) -- > Click Browse
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
19 of 22 6/11/2015 1:02 AM
10.2 Drag and drop measures in to Detail fields, & Drag and Drop Dimension Attributes in Row Field or Column fields.
Now to Browse Our Cube
Product Name Drag & Drop into Column1.
Full Date UK Drag & Drop into Row Field2.
FactProductSalesCount Drop this measure in Detail area3.
We will see some more features shortly - how can we assign user friendly names, named calculations, named query, ordering on hierarchy,
hiding dimension attributes, creating perspective, KPI, security roles, etc.
Friends, if you liked my article, please do not forget to vote for me.
Enjoy SQL Intelligence.
License
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Share
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
20 of 22 6/11/2015 1:02 AM
Search Comments Go
About the Author
You may also be interested in...
Create First SSRS Report with SQL
Server Analysis Services OLAP Cube
Challenging Some of the Myths
About Static Code Analysis
Cubes, MDX, Analysis Services and
ADOMD in C#
Is SQL Server killing your
application’s performance?
Tree utilities in SQL Server 2000 and
2005, and OLAP implementations
SAPrefs - Netscape-like Preferences
Dialog
Comments and Discussions
You must Sign In to use this message board.
Profile popups Spacing Relaxed Layout Normal Per page 25 Update
First Prev Next
Member 12101055 1-Nov-15 7:07
EMAIL TWITTER
Mubin M. ShaikhTeam Leader
India
Microsoft® Certified Professional (Microsoft Certification ID: 8918672).
Design and Develop Business Intelligence Solutions using Microsoft BI.
(SQL Integration Services - SSIS, SQL Analysis Services - SSAS, Reporting Services - SSRS,SQL-
Server,Dimension Modelling,Data Warehouse,Power Pivot, Power View, Power Map, Power
query,.Net,C#,WCF)
Linked In Profile:
Click Here to View Linked In Profile
Change Will Not Come If We Wait for Some Other Person,or Wait for Some Other Time, We are
the One We are Waiting For,We are the Change That we Seek.
Superb
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
21 of 22 6/11/2015 1:02 AM
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151103.1 | Last Updated 21 Jul 2014Select Language ▼
Article Copyright 2013 by Mubin M. Shaikh
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed |
fluid
leketekoa 28-Oct-15 2:44
Member 3276162 13-Oct-15 2:46
Member 12000196 21-Sep-15 4:49
ham rez 14-Sep-15 20:04
BI Rajesh 6-Sep-15 0:20
John Titi 8-Aug-15 19:00
224917 27-Jul-15 5:11
HTSoft 11-Jun-15 19:37
Member 4169279 10-Jun-15 22:55
Member 11357942 24-May-15 23:02
Member 11686114 17-May-15 19:00
Brijmohans30 10-May-15 21:14
Jamal Ansari 9-May-15 22:28
Member 11645044 27-Apr-15 2:50
gisycu 22-Apr-15 8:38
Member 11629004 22-Apr-15 2:02
Prashant Dave 15-Apr-15 21:04
Member 11551845 24-Mar-15 7:47
invincible021 10-Mar-15 19:13
Member 11584809 6-Apr-15 10:01
sumit.rastogiii 9-Mar-15 5:34
Mubin M. Shaikh 9-Mar-15 7:57
Member 8731611 24-Feb-15 0:04
Member 11075911 8-Jul-15 6:49
Last Visit: 31-Dec-99 19:00 Last Update: 5-Nov-15 4:07 Refresh 1 2 3 4 5 6 Next »
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
Great Article
Create First OLAP Cube in SQL Server Analysis Services
My vote of 5
My vote of 5
Doubt
My vote of 5
My vote of 5
Question about data security
Nice article
Big Thank You
useful article
Very Helpfull
Good Explanation
Excellent article!
Excelente artículo!!!!
--
Many thank. This is very useful for a beginner
Excellent Article
error when i deploy the cube.
Re: error when i deploy the cube.
Error while deployment
Re: Error while deployment
Error when processing the Cube
Re: Error when processing the Cube
Create First OLAP Cube in SQL Server Analysis Services - CodeProject http://www.codeproject.com/Articles/658912/Create-First-OLAP-Cube-i...
22 of 22 6/11/2015 1:02 AM