我正在工作的公司要求提供有关加班时间的KPI。他们想测量它是否低于3%的设定阈值。有一个名为[Measures]的计算成员。[加班时间百分比(%)],可以使用。
但是,他们希望将KPI限制在他们可用的2个部门。
我尝试通过指定此KPI值表达式来限制值:
([Measures].[Percentage of Overtime Hours (%)], {[Project].[Project Department].&[Department A], [Project].[Project Department].&[Department B]})
但是,这会给我以下错误消息:
#Error The function expects a string or numeric expression for the argument. A tuple set expression was used.
在MSDN上,我找不到答案。谷歌没有给我任何体面的结果,因为我不知道究竟要搜索什么。限制一个度量只是给了我很多关于FILTER表达式如何工作的文章,这似乎不是我想要的。
如何将KPI值限制为仅2个部门?
我尝试按照建议使用SCOPE语句。
CREATE MEMBER CURRENTCUBE.[Measures].[Percentage of Overtime Hours (%) for AB] AS null;
SCOPE([Measures].[Percentage of Overtime Hours (%) for AB]);
This = NULL;
SCOPE([Project].[Project Department].&[Company A]);
This = ([Measures].[Percentage Overtime (%)], [Project].[Project Department].&[Company A]);
END SCOPE;
SCOPE([Project].[Project Department].&[Company B]);
This = ([Measures].[Percentage Overtime (%)], [Project].[Project Department].&[Company B]);
END SCOPE;
SCOPE([Project].[Project Department].[All]);
This = AGGREGATE({[Project].[Project Department].&[Company A], [Project].[Project Department].&[Company B]}, [Measures].[Percentage Overtime (%)]);
END SCOPE;
END SCOPE;
然而,这似乎将同一问题推向了一个更深层次的问题。在[项目] [项目部门] [项目部门] [全部]级别查看[测量]。[AB的加班时间百分比(%)]时,会变得清晰。它返回NULL。还有其他建议吗?
答案 0 :(得分:0)
您收到错误是因为您使用的是元组(...)
,而在元组内部您只有一个成员,后跟一个集合:
( //<<braces indicate a tuple
[Measures].[Percentage of Overtime Hours (%)] //<<single member
,{
[Project].[Project Department].&[Department A] //<<two member set
,[Project].[Project Department].&[Department B]
}
)
如果您将此添加到cube script
,那么您可以进行范围分配吗?
我对这些作业的经验非常有限,但可能如下:
CREATE MEMBER currentcube.[Measures].[Percentage of Overtime Hours (%) for AB]
AS null;
SCOPE( ({
[Project].[Project Department].&[Department A]
,[Project].[Project Department].&[Department B]
},
[Measures].[Percentage of Overtime Hours (%)]
));
this = [Measures].[Percentage of Overtime Hours (%)];
END SCOPE;