MDX - 显示相关项目的维度值

时间:2017-01-09 14:26:30

标签: ssas mdx

我有一个案例,如果该项目没有所选日期的交易,那么通过标准它将显示空白值/根本不显示,但我想如果根本没有任何度量/交易它将改为显示该项目维度的单价。

我已经尝试过以下脚本,但它仍然没有像我预期的那样显示。有什么帮助吗?

CREATE MEMBER CURRENTCUBE.[Measures].[Minimum Selling Price custom1]
                                AS 
IIF(
    ISEMPTY
        (
            MIN(PERIODSTODATE([Date].[Date YQMD].[(All)], [Date].[Date YQMD]), [Measures].[Minimum Minimum Sell Price])
        )
        , [Item].[Unit Price]
        , MIN(PERIODSTODATE([Date].[Date YQMD].[(All)], [Date].[Date YQMD]), [Measures].[Minimum Minimum Sell Price])
    ),
    FORMAT_STRING = "#,#.00",
    VISIBLE = 1;


                                ([Measures].[Minimum Selling Price custom1], [Date].[Date YWD].[Week].Members) = 
IIF(
    ISEMPTY
        (
            MIN(PERIODSTODATE([Date].[Date YWD].[(All)], [Date].[Date YWD]), [Measures].[Minimum Minimum Sell Price])
        )
        ,[Item].[Unit Price]
        ,MIN(PERIODSTODATE([Date].[Date YWD].[(All)], [Date].[Date YWD]), [Measures].[Minimum Minimum Sell Price])
    )
;
-- fiscal date

                                ([Measures].[Minimum Selling Price custom1], [Date].[Fiscal Date YPD].[Fiscal Year].Members) = 
IIF(
    ISEMPTY
            (
                MIN(PERIODSTODATE([Date].[Fiscal Date YPD].[(All)], [Date].[Fiscal Date YPD]), [Measures].[Minimum Minimum Sell Price])
            )
            ,[Item].[Unit Price]
            ,MIN(PERIODSTODATE([Date].[Fiscal Date YPD].[(All)], [Date].[Fiscal Date YPD]), [Measures].[Minimum Minimum Sell Price])
    )
;


([Measures].[Minimum Selling Price custom1], [Date].[Fiscal Date YPD].[Accounting Period].Members) = 
IIF(
    ISEMPTY
            (
                MIN(PERIODSTODATE([Date].[Fiscal Date YPD].[(All)], [Date].[Fiscal Date YPD]), [Measures].[Minimum Minimum Sell Price])
            )
            , [Item].[Unit Price]
            , MIN(PERIODSTODATE([Date].[Fiscal Date YPD].[(All)], [Date].[Fiscal Date YPD]), [Measures].[Minimum Minimum Sell Price])
    )
;                               

1 个答案:

答案 0 :(得分:0)

您必须向Item属性添加列值,并使用MemberValue函数获取实际值。见https://msdn.microsoft.com/en-us/library/ms146082.aspx

请为您提供立方体结构以便实际解释。