Showing posts with label SSAS. Show all posts
Showing posts with label SSAS. Show all posts

Wednesday, May 23, 2012

Deployment Options for BISM Project

 

There are two Query Mode options you could use when you deploy the BISM project to the AS Tabular Model server.

    • In-Memory
    • DirectQuery

    image

    By default, data in tabular model is processed, compressed using the xVelocity in-memory analytics engine (VertiPaq).  This in-memory columnar storage engine has been optimized for high performance analysis and exploration of data.  It provides fast query times for aggregation queries.

    However, there are some drawbacks:

    • Data is not updated when the source data changes. Model needs to be processed to refresh the data.
    • When you turn off the computer hosting the model, the cache is saved to disk and must be reopened when you load the model.
    • The save and load operations can be time-consuming.
    • Need lots memory to hold the large fact data

    On the other hand, DirectQuery mode uses data that is stored in a SQL Server database. It lets users retrieve data directly from a SQL Server data source in  real time.  This mode also lets you create models and build reports for large data sets that cannot reside in memory.

    Here are additional benefits:

    • The data is guaranteed to be up-to-date.
    • Use the advantage of provider-side query acceleration, i.e. SQL 2012 column indexes.
    • Could use row-level security provided by the backend  database.
    • Analysis Services can perform optimization to ensure the query plan against the backend database will be as efficient as possible.

    There are some design considerations if you are planning to use DirectQuery mode:

    • During design phase, you may need to use Preview or Filter function to load subset data into your project.
    • MDX queries are not supported for a model in DirectQuery mode. You cannot use PPS or other clients that only issue MDX queries to consume it.
    • Currently this model only supports one data connection. You cannot query two or more SQL Servers from a DirectQuery enabled model.
    • Calculated columns and some DAX functions are not supported. You may need to use SQL View or other technique for that purpose.

    DirectQuery supports a hybrid deployment mode that can use either the cache or the relational source. For more information, see DirectQuery Mode (SSAS Tabular).

     

    Reference

    Formula Compatibility in DirectQuery Mode

    DirectQuery Mode (SSAS Tabular)

    White Paper: Using DirectQuery in the Tabular BI Semantic Model

    Sunday, March 18, 2012

    Sort a MDX Dataset by Multiple Criteria

    Recently I work on a SSRS report that needs a parameter to return a set of user to be selected as the filter for the report.  The list of user has to be sorted by Department Code and User’s name.

    In MDX, sorting a dataset based on one criterion is directly supported
    through the Order( ) function.  However, it doesn’t support multiple
    criteria for sorting explicitly.  In order to sort the dataset with multiple criteria, some tricks will be needed to complete the task.

    Sample Data

    image

    Here is how we could return a user list dataset that are sorted by Department Code and User Name.

    Trick One:

    Concatenate the two attributes into one and then use Order() function to sort it accordingly. 

    WITH MEMBER [Measures].[ParameterCaption] 
    AS [User].[User].CURRENTMEMBER.MEMBER_CAPTION 
     
    MEMBER [Measures].[ParameterValue] 
    AS [User].[User].CURRENTMEMBER.UNIQUENAME 
     
    MEMBER [Measures].[Department] 
    AS [User].[User].CURRENTMEMBER.Properties( "Department Code")
     
    SELECT {  [Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[Department] } ON COLUMNS ,  
    {
        ORDER(
                    [User].[User].Children ,
                    [User].[User].CURRENTMEMBER.Properties( "Department Code") + [User].[User].CURRENTMEMBER.MEMBER_CAPTION, 
                    BASC
                    )
    } ON ROWS
    FROM [Test]
     

    As you could see, the result set returned has been sorted by Department first and then Username in alphabetical ascending order.


    image
    You may use this trick when the sorting order of both members are in the same direction either ascending or descending.


    Trick TWO


    When the sorting criteria are in different alphabetical order i.e. one in ascending order and the other in descending order, we will need to use two ORDER() functions.



    WITH MEMBER [Measures].[ParameterCaption] 
    AS [User].[User].CURRENTMEMBER.MEMBER_CAPTION 
     
    MEMBER [Measures].[ParameterValue] 
    AS [User].[User].CURRENTMEMBER.UNIQUENAME 
     
    MEMBER [Measures].[Department] 
    AS [User].[User].CURRENTMEMBER.Properties( "Department Code")
     
    SELECT {  [Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[Department] } ON COLUMNS ,  
    {
     ORDER( 
            ORDER(
                    [User].[User].Children ,
                    [User].[User].CURRENTMEMBER.MEMBER_CAPTION, 
                    BASC
                    ),
        [User].[User].CURRENTMEMBER.Properties( "Department Code"),
        BDESC
        )
    } ON ROWS
    FROM [Test]

    As you could see, the result set returned now will be sorted by the Department Code in descending order first, then the Username in ascending order.


    image


    Reference


    http://msdn.microsoft.com/en-us/library/ms145587.aspx

    Thursday, January 26, 2012

    Publish a BISM Tabular Model Database Connection on SharePoint 2010

    Once you built a BISM Tabular Model project and deployed to SSAS,  you may want to publish it on the SharePoint 2010. A BISM connection allows business end users to access the underline model on SharePoint with addtional security control. It could also utilize the SharePoint quick launch commands to open the Excel Workbook or Power View Report.  For more information about how to create a BISM Tubular Model project, see my previous blog entry Create a SSAS BISM Tabular Model Project.

     

    Add the BI Semantic Model Connection Content Type to the SharePoint Library

    • Go to the SharePoint Library site that will host the connection file, click the Library in the Library Tools.
    • Click the Library Settings
    • In the General Settings section, select the Advanced settings
    image
    • In the Content Types, Select the Allow management of content types to be Yes, then click OK
    • In the Content Types section, Click on the Add from existing site content types
    • Add the BI semantic Model Connection
    image
    • After click on the OK button, you can see the BI Semantic Model Connection added in the Content type table
    image

     

    Set Up Permissions

    • Grant the Tubular Model Analysis Service administrative permissions to the SharePoint Service Account.
    • Grant the user who is going to use the connection with the Read permission on the Tabular Model database
      • Add a Role with Read permission
      • Adding the user to the Role

     

    Create the Connection File on SharePoint

    • Go to the library page, click on the Documents in the Library Tools.
    • Click on the down arrow on the New Document and select the BI semantic Model Connection.
    image
    • On the New BI Semantic Model Connection page, specify the server name and database name and then Click OK.
    image
    • On the library page, you should be able to see the new connection file.

    image


    Use the BISM Connection in SharePoint

    Now you may use Excel or Power View to consume the BISM connection file as the data source. 
    • If you create the file in PowerPivot Gallery, you could click on either the Open New Excel Workbook or Create Power View Report link on the right upper corner to open the application.
    image
    • If you create the file in the Shared Documents page, you could click on the Down Arrow on the File Name to launch either the Excel or the Power View Report.

    image

    Additional Reference
    http://technet.microsoft.com/en-us/library/hh230813(SQL.110).aspx
    http://technet.microsoft.com/en-us/library/gg492136(SQL.110).aspx

    Wednesday, September 28, 2011

    Create a SSAS BISM Tabular Model Project

    To create a SSAS tabular model project, you will need to install the BIDS (now called Microsoft SQL Server Data Tools in SQL 2012) and have a SQL Server Analysis Services running in tabular mode (xVelocity in-memory analytics engine (VertiPaq)). It is recommended that the AS and the BIDS are installed on the same machine.

    Install an Analysis Services instance running in tabular mode

    • Add new feature to existed instance or add new instance

    image 

    • Select the Server Mode: Tabular Mode and add yourself as the administrator

    image 

    You could verify the AS Server mode using the SQL Server Management Studio and note the icon next to the server name in the Object Explore. You could also check the DeploymentMode property (0 =Traditional,  1 = PowerPivot for SharePoint, 2 = Tabular) in the msmdsrv.ini file.

    image

    Create New project

    • Open Visual Studio 2010 and select New project
    • There are three types of project template as shown below:
      • Analysis Service Tabular Project: Use this template to create an Analysis Service project with tabular models
      • Import from PowerPivot: Use this template to create a tabular project by extracting the metadata and data from an existing PowerPivot workbook
      • Import from Server (Tabular): Use this template to create a tabular project by extracting the metadata from an existing tabular AS server

    image

    • Once you create a project, you could import your data source by clicking on the Model on the toolbar and select the Import From Data Source to start the Table Import Wizard.

    image

    • You could either create a connection or use an existing connection to import the tables or data you need.  There are lots of choices such as Relational databases, Multidimensional Source, Data Feeds, or Text Files.

    image

    • You could change your model view from Data View to Diagram View by either clicking on the Model View on the Model or the icons on the right low corner.

    image image

    • You could manage the relationships or create hierarchies using the Diagram View.  You could create and manage measures in Data View.
    • Once you finishing modeling your project, you may deploy it to your AS Tabular model server to be used.

    image

    Issue or Error

    You may encounter the following error: Unable to connect to default workspace database server, which indicates that you have not yet set up a default workspace server.

    image

    To fix it, you could click on the Options from the Tools menu and then select the Analysis Services option to set the default workspace server and deployment server.

    image

     image

    If you are interested about how to use the model once you created, you may want to check out my other post : Publish BISM Tabular Model Database Connection on SharePoint 2010.

     

    Reference:

    http://msdn.microsoft.com/en-us/library/hh231722(v=SQL.110).aspx

    http://blogs.msdn.com/b/analysisservices/archive/2011/07/13/welcome-to-tabular-projects.aspx

    Monday, May 9, 2011

    Enhance PowerPivot Cube using Visual Studio 2008 R2

    PowerPivot is a self service BI tool that you may use it to prototype your work quickly. The SQL Server Analysis service that PowerPivot cube used is a VertiPaq storage mode which is different from the traditional  MOLAP, ROLAP or HOLAP cube. It is a read only temporary cube that PowerPivot Service creates and manages. You may persist or enhance it using Visual Studio 2008 (SQL Server 2008 R2). 

    Here are the steps to enhance it using Visual Studio:

    • Backup and Restore the PowerPivot Sandbox database with a different name on the VertiPaq Mode SSAS.
    • Open the Analysis Service Database option to point to the restored database from Visual Studio to create a new project.

      image

    • Once the project is created, you could see all the dimensions and a cube called Sandbox in the project.

      image

    • The Data Sources contains a connection string that connects to the original data source used by the PowerPivot workbook.
    • The Data Source Views contains all the tables from the PowerPivot workbook as Named Queries.
    • Since it is a read only cube, if there is any modification or trying to process the cube, you will get the following error

    clip_image002

    • To overcome the read only issue, you need to detach and then attach it by unselecting the Read-only checkbox to change the ReadWrite mode to be ReadWrite.

    image 

    • Now you should be able to add a new MDX or DAX measure and then deploy/process it.

    image

    • You could view your result in both the Visual Studio or SSMS.

    image

    • If you try to restore the PowerPivot Cube on a traditional SSAS Server, you will encounter the following error: Backup and restore errors: Restore failed. The backup file was created on a server with DeploymentMode=1 and the current server is running DeploymentMode=0. (Microsoft.AnalysisServices)

    clip_image002[4]

    Wednesday, August 25, 2010

    How to Process SSAS Dimensions Individually and Automatically

      Sometime there is need to process the cube dimensions individually, so you could create logs to trace the dimension that has been processed, or to recover from the failed point without restart the whole process. We can create a SSIS Task and schedule it in SQL Agent Job as following steps:
      • Create a new Integration Service project.
      • Add execute SQL task with OLE DB connect to the analysis service database
        • Query list of dimensions in a SSAS database using DMV as following and save it into a SSIS object variable
        SELECT DISTINCT DIMENSION_NAME 
        FROM  $SYSTEM.MDSCHEMA_DIMENSIONS
        WHERE LEFT(CUBE_NAME,1) = '$'
        AND [DIMENSION_UNIQUE_NAME] <> '[Measures]'
        ORDER BY DIMENSION_NAME

        • Create a ForEach Loop Container and set the collection to retrieve the dimension name from the above step

        • Add the Analysis Services Processing Task with a SSAS connection to the to be used in the container


        • Edit the task by using expression to set the XMLA dynamically in the ProcessingCommands property with the dimension that we want to process.

        • Here is the sample XMLA to be used in expression editor:
                    

        • You may use SSMS to connect to the SSAS and select a Dimensions in a database to use the Script function to create the XMLA for you as template. You may change the Process Options as needed.

        • Once you have the SSIS Package, go to SQL Server Agent and add a SQL Job with Job Type as SQL Server Integration Service Package. Select the Package Location and set the schedule option as per your requirement.
        That’s it. Now all the dimensions will be processed at the scheduled intervals.
        This way, any newly added dimensions will also get processed without modifying the SSIS package.

        "<Batch xmlns=\"http://schemas.microsoft.com/analysisservices/2003/engine\"> 
        <Parallel> 
        <Process xmlns:xsd=\http://www.w3.org/2001/XMLSchema\ xmlns:xsi=\http://www.w3.org/2001/XMLSchema-instance\ xmlns:ddl2=\http://schemas.microsoft.com/analysisservices/2003/engine/2\ xmlns:ddl2_2=\http://schemas.microsoft.com/analysisservices/2003/engine/2/2\ xmlns:ddl100_100=\"http://schemas.microsoft.com/analysisservices/2008/engine/100/100\">
        <Object>
        <DatabaseID>" + @[User::_DatabaseID] + "</DatabaseID>
        <DimensionID>" + @[User::_DimensionName] + "</DimensionID>
        </Object>
        <Type>ProcessFull</Type>
        <WriteBackTableCreation>UseExisting</WriteBackTableCreation>
        </Process>
        </Parallel>
        </Batch>"