ssas 2005 mdx get total

2019-09-03 08:33发布

问题:

I have this MDX query

    select 
    {
        [Measures].[Sold value]
        ,[Measures].[Units]
        ,[Measures].[Sales baskets]
        ,[Measures].[ATV]
        ,[Measures].[AUT] 
    } on columns

    , filter(
        nonempty(
            {[Branch].[Branch].&[5] *[Receipt No - Sales].[Receipt No].[Receipt No]}
        ),
        [Measures].[Sold value] >= 50
    ) on rows
    from Rmis
    where [Time].[Day].&[20131218]

Which generates following result:

How can I get the total of these measures of the above result set? The total should use the aggregation defined in the cube.

回答1:

with set [rows] as
    filter(
        nonempty(
            {[Branch].[Branch].&[5] *[Receipt No - Sales].[Receipt No].[Receipt No]}
        ),
        [Measures].[Sold value] >= 50
    )

    member [Receipt No - Sales].[Receipt No].[Total] as
    aggregate([rows])

select 
    {
        [Measures].[Sold value]
        ,[Measures].[Units]
        ,[Measures].[Sales baskets]
        ,[Measures].[ATV]
        ,[Measures].[AUT] 
    } on columns
    ,
    { ([Branch].[Branch].&[5], [Receipt No - Sales].[Receipt No].[Total]) }
    +
    [rows]
    on rows
    from Rmis
    where [Time].[Day].&[20131218]


标签: ssas mdx