O'Reilly logo

Microsoft® SQL Server® 2008 MDX Step by Step by C Ryan Clay Bryan C Smith and Hitachi Consulting

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7 Quick Reference

To

Do this

Sum a set of values

Use the Sum function to sum the current measure or an optionally supplied expression over the tuples in the set. For example, the following query sums reseller sales for the top five products:

WITH
MEMBER [Product].[Subcategory].[Top 5] AS
    Sum(
        TopCount(
            [Product].[Subcategory].[Subcategory].Members,
            5,
            ([Measures].[Reseller Sales Amount])
             ),
        ([Measures].CurrentMember)
        )
SELECT
    {([Measures].[Reseller Sales Amount])} ON COLUMNS,
    {
        ([Product].[Subcategory].[Top 5]),
         ([Product].[Subcategory].[All Products])
         } ON ROWS
FROM [Step-by-Step]

Aggregate a set of values based on their underlying aggregate functions

Use the Aggregate function to aggregate the current measure or an optionally supplied expression ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required