我在MDX
With
member [Week Count] as
(
([WORK ].[Complying Flag].&[COMPLYING], [Measures].[No of Work ])
/([WORK ].[Complying Flag].[(All)].[All], [Measures].[No of Work ])) *100
select
{[Week Count]} on columns,
{[CLOSED DATE].[Week End Date].members} on rows
FROM [test ]
我需要添加条件where [Measures].[ACT LAB HRS]>0
但它总是返回错误,如何纠正呢?
答案 0 :(得分:4)
你可以使用Filter
,但我们需要一个集合来过滤这样的东西:
WITH
MEMBER [Week Count] as
(
([WORK ].[Complying Flag].&[COMPLYING], [Measures].[No of Work ])
/([WORK ].[Complying Flag].[(All)].[All], [Measures].[No of Work ])
) *100
SELECT
{[Week Count]} on columns,
{[CLOSED DATE].[Week End Date].members} on rows
FROM [test]
WHERE
(
FILTER
(
[SomeDimension].[SomeHierarchy].members,
[Measures].[ACT LAB HRS]>0
)
);
另一种方法是包含HAVING
子句:
WITH
MEMBER [Measures].[Week Count] as
(
([WORK ].[Complying Flag].&[COMPLYING], [Measures].[No of Work ])
/([WORK ].[Complying Flag].[(All)].[All], [Measures].[No of Work ])
) *100
SELECT
{
[Measures].[Week Count],
[Measures].[ACT LAB HRS]
} ON 0,
{[CLOSED DATE].[Week End Date].members}
HAVING [Measures].[ACT LAB HRS]>0
ON 1
FROM [test];