计算成员显示所有成员,包括事实不存在的位置

时间:2012-05-11 12:52:23

标签: ssas mdx member cube

我创建了一个分配客户类型的计算成员。问题在于它显示了来自客户维度的每个成员,而且我没有太多经验来解决它。

我想只展示真正订购的客户。 例如[措施]。[总金额]> 0 目前选定的时期。例如今年。 ([基本日历]。[年 - 周 - 日期])

请告知并查看以下公式。

CREATE MEMBER CURRENTCUBE.[Measures].[Customer Type]
 AS IIF( [Measures].[Orders by Customer]=0, "Zero Customer",
            IIF( [Measures].[Orders by Customer]=1, "One Off Customer",  
            IIF([Measures].[Orders by Customer]>1 and [Measures].[Orders by Customer]<4 , "2 to 3 Orders", 
            IIF([Measures].[Orders by Customer]>3 and [Measures].[Orders by Customer]<6,  "4 to 5 Orders", 
            IIF([Measures].[Orders by Customer]>5, "VIP Customer",  "Other"))))), 
VISIBLE = 1  ;   

非常感谢

1 个答案:

答案 0 :(得分:2)

只需添加一个返回null的“空”条件:

CREATE MEMBER CURRENTCUBE.[Measures].[Customer Type]
 AS
            IIF( IsEmpty([Measures].[Orders by Customer]), null,
            IIF([Measures].[Orders by Customer]=0, "Zero Customer",
            IIF( [Measures].[Orders by Customer]=1, "One Off Customer",  
            IIF([Measures].[Orders by Customer]>1 and [Measures].[Orders by Customer]<4 , "2 to 3 Orders", 
            IIF([Measures].[Orders by Customer]>3 and [Measures].[Orders by Customer]<6,  "4 to 5 Orders", 
            IIF([Measures].[Orders by Customer]>5, "VIP Customer",  "Other")))))), 
VISIBLE = 1  ;