Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MDX计数作用域为当前上下文日期_Mdx - Fatal编程技术网

MDX计数作用域为当前上下文日期

MDX计数作用域为当前上下文日期,mdx,Mdx,我希望我的MDX查询能够计算员工全天工作的天数 度量值为小时数和有人值守的小时数,维度为员工和日历日期。我不确定如何修改此查询: WITH MEMBER [Measures].[IsPresent] as IIF([Measures].[Hours] >= [Measures].[Attended Hours],1,0) MEMBER [Measures].[CountOfDays] as DISTINCTCOUNT(EXISTING FILTER([Calender Date].

我希望我的MDX查询能够计算员工全天工作的天数

度量值为小时数和有人值守的小时数,维度为员工和日历日期。我不确定如何修改此查询:

WITH MEMBER [Measures].[IsPresent] as IIF([Measures].[Hours] >= [Measures].[Attended Hours],1,0)
    MEMBER [Measures].[CountOfDays] as DISTINCTCOUNT(EXISTING FILTER([Calender Date].[Calender].[Date], [Measures].[Hours] >= [Measures].[Attended Hours]))

    select {[Employee].[Number].[Number].ALLMEMBERS} on 0, {[Measures].[CountOfDays]} on 1 from (
        SELECT ({[Employee].[Number].[Number].ALLMEMBERS},{[Measures].[Hours],[Measures].[Attended Hours]}) ON 0
        , { [Calender Date].[Calender].[Date]}on 1
        From (select {[Calender Date].[Calender].[Date].&[2016-01-01T00:00:00] : [Calender Date].[Calender].[Date].&[2016-01-31T00:00:00]}  ON COLUMNS 
    FROM [BJ Cube]  WHERE ([Calender Date].[Is Work Day].&[Y]))
    )
示例数据集是:


以下MDX是否适用于您

MEMBER [Measures].[CountOfDays] as
SUM( 
    existing [Calender Date].[Calender].[Date].Members,
    IIF(
      [Measures].[Hours] >= [Measures].[Attended Hours],
      1,
      NULL
    )
)

计算成员不受MDX中自动存在的约束,因此此成员不会根据条件[日历日期].[日历日期].[日期]和[2016-01-01T00:00:00]:[日历日期].[日历日期].[日期]和[2016-01-31T00:00:00]筛选数据。您的意思是什么?你能详细说明你的问题吗?