具有顶部/底部x值过滤器的层次结构的总成员

时间:2012-12-06 20:11:16

标签: mdx olap msas

我正在使用带有Adventure Works DW的MSAS 2008。这是我想要使用MDX查询获得的切片的结构:

  • [产品]。[样式],[产品]。[产品类别],[度量]。[折扣金额],[度量]。[行中的经销商订单数量]
  • [产品]。列上的[颜色]

我一直在创建一个查询来从Product Categories层次结构中获取前2名成员。问题是我不知道如何为[Product]。[Style]层次结构创建新计算的Total成员。使用下面的查询,我只能为[Product]。[Product Categories]层次结构创建Total成员,但我尝试获得Style层次结构的总数失败。

WITH 
    SET [Product Color (set)] as 'DRILLDOWNLEVEL(
        {[Product].[Color].[All Products]}
    )'
    SET [Top 2 Categories For Each Style (set)] as 'GENERATE(
        [Product].[Style].[Style],
        TOPCOUNT(
            ([Product].[Style].CURRENTMEMBER, [Product].[Product Categories].[Category]),
            2,
            [Measures].[Discount Amount]
        ) + ([Product].[Style].CURRENTMEMBER, [Product].[Product Categories].[Total])
    )'
    SET [Product Style (set)] as 'DRILLDOWNLEVEL(
        {[Product].[Style].[All Products]}
    )'
    SET [rowSet] AS '[Top 2 Categories For Each Style (set)] *
                     {
                        [Measures].[Discount Amount],
                        [Measures].[Reseller Order Quantity]
                     }'
    SET [columnSet] as '[Product Color (set)]'
    member [Product].[Product Categories].[Total] as 'AGGREGATE(
        TOPCOUNT(
            ([Product].[Style].CURRENTMEMBER, [Product].[Product Categories].[Category]),
            2,
            [Measures].[Discount Amount]
        )
    )'
SELECT 
    [rowSet] ON ROWS, 
    [columnSet] ON COLUMNS 
    FROM [Adventure Works] CELL PROPERTIES VALUE

任何建议都将受到赞赏。

0 个答案:

没有答案