Pages

Sunday, February 27, 2011

Calculated Member & Named Set Definition

Analysis Services provides flexibility to add business logic by creating Calculated Member/Named Set on Measures or Dimensions in existing Cube. These are custom MDX expressions defined and saved as part of cube definition. There are multiple options to create these calculations depending on scope of use.
  1. Create Members in Calculations tab of Cube designer.
  2. Create Calculated Members at run time using client tools. For Example: SQL Server Management Studio, ProClarity...
Generally, developers know about logic behind calculated members. Sometimes, as a user, we want to know what expression has been used for these calculated members. And there is no option available to get the MDX logic behind these members except using calculation tab of cube designer.

We can use DMVs (i.e. Dynamic Management Views) to get mdx expressions of Calculated Members. DMVs are only available for SQL Server Analysis Services 2008 and not for earlier versions.
Below are stored procedures to get Calculated Members expression: In order to run these procedures, create a linked server on Analysis Server. Here in these examples, linked_server name is 'CUBE'.

1. Get Calculated Measure Expression:
Parameters detail:
  1. @linked_server: Name of Linked Server created on Analysis Server.
  2. @cube_name: Cube Name
  3. @measure_name: Calculated Measure Name
/*
EXEC GET_MEASURE_EXPRESSION @linked_server = 'CUBE'
                        , @cube_name = 'Adventure Works'
                        , @measure_name = 'Internet Gross Profit'
*/
CREATE PROCEDURE GET_MEASURE_EXPRESSION
    @linked_server VARCHAR(100)
    ,@cube_name VARCHAR(100)
    ,@measure_name VARCHAR(100)   
AS
BEGIN
    SET NOCOUNT ON
   
    DECLARE @cube_script VARCHAR(max)
    DECLARE @script VARCHAR(max)
    SET @cube_script = 'SELECT * FROM $system.mdschema_measures
                        WHERE CUBE_NAME = ''''' + @cube_name + '''''
                        AND MEASURE_NAME = ''''' + @measure_name + ''''''
    SET @script = 'SELECT
                    "MEASURE_NAME" AS MEASURE_NAME
                    ,"MEASUREGROUP_NAME" AS DIMENSIONS
                    ,"EXPRESSION" AS EXPRESSION
                    ,"DEFAULT_FORMAT_STRING" AS FORMAT_STRING
                    FROM OPENQUERY('+@linked_server+', '''
                    +@cube_script+ ''')'
    --PRINT @script
    EXEC (@script)
   
    SET NOCOUNT OFF
END


2. Get Named Set Expression:
Parameters detail:

  1. @linked_server: Name of Linked Server created on Analysis Server.
  2. @cube_name: Cube Name
  3. @set_name: Set Name
/*
EXEC GET_SET_EXPRESSION @linked_server = 'CUBE'
                        , @cube_name = 'Adventure Works'
                        , @set_name = 'Core Product Group'
*/
CREATE PROCEDURE GET_SET_EXPRESSION
    @linked_server VARCHAR(100)
    ,@cube_name VARCHAR(100)
    ,@set_name VARCHAR(100)   
AS
BEGIN
    SET NOCOUNT ON
   
    DECLARE @cube_script VARCHAR(max)
    DECLARE @script VARCHAR(max)
    SET @cube_script = 'SELECT * FROM $system.mdschema_sets
                    WHERE CUBE_NAME = ''''' + @cube_name + '''''
                    AND SET_NAME = ''''' + @set_name + ''''''
   
    SET @script = 'SELECT
                    "SET_NAME" AS SET_NAME
                    ,"DIMENSIONS" AS DIMENSIONS
                    ,"EXPRESSION" AS EXPRESSION
                    FROM OPENQUERY('+@linked_server+', '''
                    +@cube_script+ ''')'
    --PRINT @script
    EXEC (@script)
   
    SET NOCOUNT OFF
END

These procedures can be modified as per requirement to get more detail about Set/Member expressions.

More on DMV queries: SSAS DMV(Dynamic Management View)


Readers: Kindly share your comments & suggestions. 

29 comments:

  1. I found, this blog content very useful and informative,I am sure it will really help me a lot about SSAS

    ReplyDelete
  2. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.
    Azure Online Training

    Business Analysis Online Training

    Cognos Online Training

    ReplyDelete
  3. The quickbooks payroll support telephone number team at site name is held accountable for removing the errors that pop up in this desirable software. We look after not QuickBooks Payroll Support Phone Number any issue can be purchased in in the middle of your work

    ReplyDelete
  4. Why you ought to choose QuickBooks Enterprise Support The main intent behind is to supply the technical help 24*7 so as with order to prevent wasting your productivity hours.

    ReplyDelete
  5. when it comes to moment support we have a tendency to are accessible for you personally 24*7. Our talented team of professionals is invariably in a position to help you whatever needs doing. QuickBooks Support Number Service can be obtained 24*7

    ReplyDelete
  6. move heaven and earth to provide you with the most effective solution they can. Our customer service executives have significant amounts of experience and so are sharp QuickBooks Enterprise Tech Support Number in finding out the particular cause and optimal solution each and every error that you could face. Contact us anytime for our uninterrupted support even as we are available 24*7for your help.

    ReplyDelete
  7. You might need advanced software. There must be a premier mix solution. QuickBooks Payroll Support Contact Number often helps. Proper outsource is a must. You'll discover updates concerning the tax table.Traders become free. No one will blame you. The outsourced team will quickly realize all.

    ReplyDelete
  8. Dial QuickBooks payroll support number to make certain that our experts can guide you to run your payroll services easily, efficiently without facing QuickBooks errors. Our QuickBooks Payroll Support Number team provides you Quickbooks Payroll customer care to help you to pay employees, after low-taxes and deductions. Our QuickBooks support number covers a large area of QB services.

    ReplyDelete
  9. If you are suffering from any errors or issues pertaining to QuickBooks like undo reconciliation in QuickBooks online and many others. Simply contact our QuickBooks support team through toll-free QuickBooks Customer Service Phone Number.

    ReplyDelete
  10. All of these issues mentioned above are a couple of examples of what type of tech glitches users may face. QuickBooks Enterprise help is the only solution for the range of issues. So, experience of our QuickBooks support team with the QuickBooks Enterprise customer care number to enjoy most of the latest plans and services made available from us globally. Dial our QuickBooks Enterprise Tech Support Number to have an instant QuickBooks help.

    ReplyDelete
  11. With automated features and tools is sold with different issues and errors into the software. Hunting for a dependable QuickBooks Enterprise Support channel who is able to successfully deliver high quality tech support team services?

    ReplyDelete
  12. QuickBooks Tech Support Phone Number has indeed developed an excellent software product to manage the financial needs associated with the small and medium-sized businesses. The name regarding the application is QuickBooks. QuickBooks, particularly, doesn't have any introduction for itself. But one who is unknown to this great accounting software, we wish one to give it a try.

    ReplyDelete
  13. At QuickBooks Phone Support we work on the principle of consumer satisfaction and our effort is directed to give a transparent and customer delight experience. A timely resolution in the minimum span could be the targets of QuickBooks Tech Support NumberPro-Advisors. The diagnose and issue resolution process has been made detail by detail and is kept as facile as it is possible.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. It really is a fantastic money management system for numerous companies all over the world. When using it, an appropriate and effective QuickBooks help is needed by either you or your
    QuickBooks Support Number online accountant for the best using this software.

    ReplyDelete
  16. If this doesn’t assist you to, go right ahead and hook up to us at QuickBooks Tech Support Number. Many of us works 24*7 and serve its customers with excellent service whenever they call us. It doesn't matter what issue is and however complex it is actually, we assure you that we provides you with optimal solution as quickly as possible.

    ReplyDelete
  17. QuickBooks Support accounting software is compatible even yet in the Macintosh operating system and users can enjoy all of the features provided by downloading it. This software could also be used on iPhone through the QuickBooks app for iOS users.

    ReplyDelete
  18. You can easily reach our staff via QuickBooks Support Phone Number & get required suggestion most likely time. The group sitting aside understands its responsibility as genuine & offers reasonable help with your demand.

    ReplyDelete
  19. QuickBooks support is internationally recognized. You have to arrive at used to understand this help.Contact our Technical Team with QuickBooks Support Phone Number.

    ReplyDelete
  20. Our QuicKbooks Tech Support Phone Number is obtainable for 24*7: Call @ QuickBooks Technical Support contact number any time. Take delight in with an array of outshined customer service services for QuickBooks via quickbooks technical support contact number at any time and from anywhere.

    ReplyDelete
  21. With exceptional features, QuickBook helps most of the kinds of businesses with generating accounting reports, entries for every single sale, transactions pertaining to banking, etc., with a lot of ease. And along side QuickBooks Support for QuickBooks, it really is much simpler to undertake all of the tools of QuickBooks in a hassle-free manner.

    ReplyDelete
  22. The user can surely get generate real-time basis advanced reports by using QuickBooks. If a person is certainly not known for this feature, then, it is possible to call our QuickBooks Tech Support Phone Number. They will surely provide you with the necessary information to you.

    ReplyDelete
  23. QuickBooks Enterprise Tech Support Phone Number assists anyone to overcome all bugs from the enterprise forms of the applying form. Enterprise support team members remain available 24×7 your can buy facility of best services.

    ReplyDelete
  24. This comment has been removed by the author.

    ReplyDelete
  25. Our hard-working QuickBooks Support Phone Number. team that contributes into the over all functioning of your business by fixing the errors that could pop up in QuickBooks Payroll saves you against stepping into any issue further.

    ReplyDelete
  26. Tax Calculations: with the aid of this, the tax calculations have grown to be a cup of tea. Tax submission has now become a click away. Direct deposit: QuickBooks Payroll Support Number gives the advantageous asset of direct deposits to your users.

    ReplyDelete
  27. QuickBooks Support Phone Number are able to also help customize the settings associated with software, add and configure employee profiles, as well as resolve all issues and error messages hampering the performance of this software.

    ReplyDelete

  28. You can further see the contact information on how to Contact QuickBooks Phone Number. QuickBooks Support Phone Number team are active for only 5 days (Mon-Fri) in per week. The QuickBooks support phone number is available these days from 6 AM to 6 PM.

    ReplyDelete
  29. Very Informative post. Thanks for Sharing.
    UnoGeeks Offers the best Oracle Fusion Financials Training in the market today. oracle Fuison Financials Training

    ReplyDelete