How to get sub totals and grand total in MDX query

Posted on 2008-11-19
Last Modified: 2013-11-16

Is it possible to get subtotals and grand total in MDX query? Is there any alternative for "WITH ROLLUP" in MDX?

Sample query will be greatly appreciated.

Thanks in advance
Question by:theoremindia
    1 Comment
    LVL 8

    Accepted Solution

    This code comes from ProClarity. You can see a local calculated member [ Subtotal].

    WITH MEMBER [Product].[Product Model Categories].[All Products].[ Subtotal] AS ' AGGREGATE( EXISTING { [Product].[Product Model Categories].[All Products].CHILDREN }) ', SOLVE_ORDER = 1000  SELECT { [Date].[Calendar].DEFAULTMEMBER } ON COLUMNS ,
    { { [Product].[Product Model Categories].[All Products].CHILDREN }, { [Product].[Product Model Categories].[All Products].[ Subtotal] } } ON ROWS  
    FROM [Adventure Works] 
    WHERE ( [Measures].[Reseller Sales Amount] )

    Open in new window


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
    Creating and Managing Databases with phpMyAdmin in cPanel.
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now