MDX查询到日期范围内的特定日期除外

时间:2016-08-04 13:36:17

标签: mdx mondrian

我需要从套装中删除所有2个月。此代码返回所有日期范围,但不包括2个月。

SELECT 
   {[Measures].[In]} ON COLUMNS,
   EXCEPT([Date].[2014].[1] : [Date].[2016].[2], [Date].[Month].[2]) ON ROWS
FROM [Shop hourly]

打印屏幕为什么theq enter image description here

我的决定基于为什么穿着。我为所有类型的日期创建了一个维度,除了它们。例如:

SELECT {[Measures].[In sum]} ON COLUMNS,
    NON EMPTY 
        {[Shop].[11], [Shop].[22], [Shop].[33]} * 
        Except([Quarter].Children, [Quarter].[2]) * 
        [Month].Children ON ROWS
FROM [Shop hourly]
WHERE 
    ([Date].[2013].[1].[1] : [Date].[2016].[1].[1]) * 
    Except([Year].Children, [Year].[2014])

enter image description here

1 个答案:

答案 0 :(得分:1)

$i=0; $count=sizeof($record->List); foreach($record->List as $Item) { $i++; echo "processing ".$i." of ".$count; ---processing code which takes times to process--- ---processing code which takes times to process--- } 我可以执行以下操作:

AdventureWorks

因此,将上述内容调整到您的多维数据集可能如下所示:

SELECT 
  [Measures].[Internet Sales Amount] ON 0
 ,NON EMPTY 
    Except
    (
        [Date].[Calendar].[Month].&[2005]&[7]
      : 
        [Date].[Calendar].[Month].&[2008]&[7]
     ,Exists
      (
        [Date].[Calendar].[Month].MEMBERS
       ,[Date].[Calendar Quarter of Year].&[CY Q3]
      )
    ) ON 1
FROM [Adventure Works];