mdx将维度成员放在度量中

时间:2014-05-01 11:55:17

标签: mdx

在SSAS 2005多维数据集中。

我有产品维度,它有一个属性:sp(售价)

我想列出sp以及产品的其他事实。但是下面的查询为sp返回null。想法?

        with member [measures].[sp] as
        [Products].[Current Sp].currentmember

        select {
            [Measures].[Sold value]
            , [measures].[sp]
            } on 0
        ,
        nonempty(
            {[Sales order details].[Receipt No].[Receipt No].allmembers}
            *{[Sales order details].[Line No].[Line No].allmembers}
            *{[Products].[Product code].[Product code].allmembers}
            , [Measures].[Sold value]
        ) on 1
        from (
            select [Time].[Day].&[20140430] on 0 from (
                select [Branch].[Branch].&[2] on 0 from (
                    select [Sales order details].[Receipt No].[680207] on 0 from [Rmis]
                ) 


            )
        )

enter image description here

更新

这是最终的工作查询。我添加了[产品]。[SKU]。[SKU],因为否则当前Sp返回'全部' (原始问题中的null是因为没有使用.Member_value)。当前Sp和产品代码无关,而它们都与[产品]相关。[SKU]。

        with member [measures].[sp] as
                [Products].[Current Sp].currentmember.MEMBER_value

                select {
                    [Measures].[Sold value]
                    , [measures].[sp]
                    } on 0
                ,
                nonempty(
                    {[Sales order details].[Receipt No].[Receipt No].allmembers}
                    *{[Sales order details].[Line No].[Line No].allmembers}
                    *{[Products].[Product code].[Product code].allmembers}
                    *{[Products].[SKU].[SKU]}
                    , [Measures].[Sold value]
                ) on 1
                from (
                    select [Time].[Day].&[20140430] on 0 from (
                        select [Branch].[Branch].&[2] on 0 from (
                            select [Sales order details].[Receipt No].[680207] on 0 from [Rmis]
                        ) 


                    )
                )

1 个答案:

答案 0 :(得分:0)

with member [measures].[sp] as
     [Products].[Current Sp].CurrentMember.MemberValue

非常接近......只需要指定要显示的属性