Wednesday, October 30, 2013

MOLAP Vs ROLAP

Which one is the best option among-st MOLAP and ROLAP ?, This one is very common question came across most of the newbie SSAS developers and the answer to this question is "Depends on the requirement"...............So Today I am going to talk on this topic.

MOLAP (Multi-dimensional Online Analytical Processing):

When you select MOLAP storage mode and process partitions, it stores a copy of source data and aggregations in a multi-dimensional structure in analysis services server. You can expect a good query performance if you are using MOLAP storage mode because MOLAP structure is highly optimized to maximize query performance and queries fetch data from multidimensional structure instead of source data. Aggregations also help in maximizing query performance.

Advantages:
   1. Good query performance than ROLAP
   2. If your cube is processed then you can access cube data even if you don't have relational source data  available

Disadvantages:
   1. Cube data gets updated only if you process cube (dimensions and partitions) so latency is high
   
Most of the organizations use MOLAP storage mode because they want high query performance for which OLAP systems are widely used. If your client is ready to work on one day prior data then its always better to use MOLAP storage mode because you will get good reporting performance and you can automate daily processing of your cube data through SQL Server jobs

ROLAP (Relational Online Analytical Processing):

When you use ROLAP storage mode, it does not store a copy of source data in the Analysis services. Aggregations of the partition also get stored in indexed views in the relational database. When you execute a MDX query on a cube having ROLAP storage mode, it first check the cache engine and if cache engine does not return data then it access the indexed views to answer a query hence it gives poor query performance than MOLAP.

Advantages:
     1. As data always get fetched from relational source, data latency is low or almost none
     2. Users always get current data without processing cube

Disadvantages:
     1. Poor query performance

If your client always need current data from relational data source and they are not worried about query performance then you can use ROLAP storage mode but you will surely see poor query performance as compared to MOLAP storage mode.

There are few other disadvantages of ROLAP mode like you cannot use MIN or MAX aggregate functions. you cannot use Views for creating your DSV. You can refer BOL article for more details.

Wednesday, October 16, 2013

MDX EXISTING keyword

Today I am going to talk about MDX "EXISTING" keyword. Seems the details provided on technet article is slightly complex to understand for a newbie developer hence I thought its better to share the details so that everyone can understand the basic usage of it.

Details: EXISTING keyword forces a specified SET to be evaluated within the current context.

Syntax: EXISTING Set_Expression

Example:

Consider a requirement wherein you want to COUNT the number of Products present under each Category. In such requirements you can build MDX using EXISTING keyword which actually explains the usage of keyword too. So we need to write a MDX query in following way for the requirement we have mentioned above.

WITH
  MEMBER [Measures].[X] AS
    COUNT([Product].[Product].[Product].MEMBERS)
  MEMBER [Measures].[Y] AS
    COUNT((EXISTING [Product].[Product].[Product].MEMBERS))
SELECT
  {
    [Measures].[X]
   ,[Measures].[Y]
  } ON 0
 ,[Product].[Category].[Category].MEMBERS ON 1
FROM [Adventure Works]

Output:


If you check the output, you will find that X is returning count of all products whereas Y is returning count of products belongs to each Category because we have given Product Category attribute on rows hence the set of products are evaluating under the context of Category.



Friday, September 27, 2013

Configure web server to access SSAS cube using Excel


This post contains step-by-step instructions for configuring web server in order to access cube using excel. After successful configuration users can access the cube using excel and can create reports using cube data.


  1. Connect to the server on which you want to configure web server for accessing cube using excel.
  2. Create a folder named CUBE under C:\Inetpub\wwwroot.
  3. Copy all the contents from the folder C:\Program Files\Microsoft SQL Server\MSAS10.MSSQLSERVER\OLAP\bin\isapi into the C:\Inetpub\wwwroot\CUBE directory.
  4. Connect to “Internet Information Services” console. Follow following steps for the same. Click on “Start” -> click on option “Run” -> type “inetmgr” and press OK button. Refer following screen shot for the same.


     5. When you click on OK button, it will open an “Internet Information Services (IIS) Manager” console.   IIS Manager Console looks like following one.          


     6. Create “Application Pool”: 
  • Right click on “Application Pools” node and select option “Add          Application Pools”. Refer following screen shot for the same.



You will get following screen when you click on “Add Application Pool”. Mention following details       under “Add Application Pool” window.

Name: CUBE
.Net Framework version: .Net Framework v2.0.50727
Managed pipeline mode: Classic
Start application pool immediately should be in a checked state.


         
      7. Convert to Application:
    • Expand “Sites” folder and then expand “Default website” node. Right click on “CUBE” folder and select option “Convert to Application”. Refer following screen shot for the same.


    • When you click on “Convert to Application”, it opens “Add Application” form.

    • Click on Select button of “Add Application” window and that will open “Select Application Pool” window. Select “CUBE” under “Application Pool” drop down and click OK button.




    • When you click on OK button, you will find that CUBE folder now appears as an application. Refer following screen for the same.


       8. Directory Property settings:

    • Click on CUBE node and double click on “Handler Mappings” option. Refer following screen shot for the same.

    • When you double click on “Handler Mappings” option, you will find following screen.

    • Click on “Add Script Map” option which will open “Add Script Map” window. Insert the details as per following screen shot.


    • When you click on OK button, you will get following message box. Click Yes.




       9.  Setting Authentication:

    • Select CUBE node under IIS manager console. Double click on “Authentication” option.

    • When you double click on “Authentication” option that will open Authentication details screen which looks like following one.



    • Right click on “Anonymous Authentication” and select “Edit” option. When you click on “Edit” option, it opens “Edit Anonymous Authentication Credentials” window which looks like following one.


    • Click on “Set...” button and insert credentials of user.


       10. Change Binding settings:

    • Click on “Default Web Site” under IIS Manager Console and click on “Bindings” option. Refer following screen shot for the same.


    • When you click on “Bindings” option, it will open “Site Bindings” window. Select a row which contains Port 80 and click on “Edit” button. Refer following screen for the same.


    • When you click on “Edit” button, it will open “Edit Site Binding” window. Change Port to 8081 and click on OK button.
        
         11. Start “Actions”:

    • Select “Default Web Site” node under IIS manager console. On the right side there is “Actions” pane, click on Start option.       


Conclusion: You have successfully established the configuration settings of web server and now user can access cube using excel.



Monday, September 16, 2013

Create Tabular Project (for newbie)

Tabular model is very new to most of the developers and if someone wants to create his/her first tabular model then this article will help. Following are the steps to create a tabular model. I am giving an example considering only 2-3 dimensions and one fact.

1. Open "Microsoft SQL Server 2012" folder and launch "SQL Server Data Tools"



2. When you launch the wizard, you will get the Start Page of Microsoft Visual Studio. Click on "New Project" and you will get "New Project" wizard. Expand "Business Intelligence" node and click on "Analysis Services" node.


3. Click on "Analysis Services Tabular Project" and give appropriate name and Location to your project. Click on OK button.



4. Click on "Model" menu from a menubar and click on "Import From Data Source.." option.


5. When you click on "Import From Data Source.." option, you will get "Table Import Wizard" wherein you can see different relational databases options which you can use to create your tabular model.

As I am using AdventureWorks sample database, I am selecting "Microsoft SQL Server" option. So select "Microsoft SQL Server" and click on "Next" button.

Note: You can download a sample database named AdventureWorksDW2012 Data File from a link.

When click on "Next" button, you will be get "Connect to a Microsoft SQL Server Database" wizard. Give server name on which you have your database restored and select "Database name"


6. Click on Next button and select the Impersonation information i.e. you can give your windows credentials or you can use service account. Click on Next button.

When you click on Next button, you will get "Choose How to Import the Data" wizard. As I am going to demo this project through tables, I am selecting option "Select from a list of Tables and views to choose the data to import". you can even write a query to import data. Click on Next button.

When you click on Next button, you will get "Select Tables and views" wizard. Select tables which you want to use to create your tabular model. For sample purpose, I am selecting "DimDate", DimProduct, DimProductCategory, DimProductSubCategory and FactInternetSales. After marking the tables as checked, Click on "Finish" button.
When you click on Finish button, you will get following "Importing" wizard.



Your Tabular Project is ready to use. Bydefault you will get Data View of your tabular model. You can check the model by selecting "Diagram View" from Model View option of Model menu.




7. You can create measures on the columns of fact table. let me show you one example. toggle to Data view model. go to FactInternetSales table and select "SalesAmount" column. Click on summation icon and select SUM option. this will create a measure on SalesAmount column with SUM as aggregate function.



8. Open the properties of measure and change name to "Internet Sales Amount". Save the changes. Right click on project and select Deploy option.



9. After successful deployment, you can browse the data using Excel pivot tables similar to multi-dimensional cube. You can hide attributes, measures which you don't want to show to client using "Hide from Clients tools". Right click on column and select option "Hide from Clients tools".