Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.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
Reporting services MDX查询不返回它应该返回的任何值-可能是由于where子句_Reporting Services_Mdx_Where Clause - Fatal编程技术网

Reporting services MDX查询不返回它应该返回的任何值-可能是由于where子句

Reporting services MDX查询不返回它应该返回的任何值-可能是由于where子句,reporting-services,mdx,where-clause,Reporting Services,Mdx,Where Clause,我正在尝试使用以下MDX查询在SSRS中创建数据集: SELECT NON EMPTY { [Measures].[Quantity],[Measures].[Total Price], [Measures]Margin],[Measures].[Profit Margin] } on columns, NON EMPTY {([Dim Product2].[Product Group], [Dim Product2].[Summary], [Dim Time].[Open Hour Buck

我正在尝试使用以下MDX查询在SSRS中创建数据集:

 SELECT NON EMPTY { [Measures].[Quantity],[Measures].[Total Price],
[Measures]Margin],[Measures].[Profit Margin] } on columns,
NON EMPTY {([Dim Product2].[Product Group], [Dim Product2].[Summary],
[Dim Time].[Open Hour Bucket].allmembers)} on rows
from [theyseemecubin]
where {([Dim Store2].[Store Key].&[1046],[Dim Date].[Calender].[Date].&[2014-11-20])}
在这里,我想总结一些商店的每日销售额,具体日期。当我只有:

where [Dim Store2].[Store Key].&[1046]
在where子句中,查询返回了正确的数据。但是,当我尝试插入日期时,结果集将变为零,尽管我在多维数据集中检查了当天应该有14台售出

我做错了什么?我是否误解了如何在MDX中使用SQL等效语句,其中StoreKey=1046,Date=2014-11-20

看起来还可以:

SELECT 
  NON EMPTY 
    {
      [Measures].[Quantity]
     ,[Measures].[Total Price]
     ,[Measures].[Margin]
     ,[Measures].[Profit Margin]
    } ON COLUMNS
 ,NON EMPTY 
    {
      (
        [Dim Product2].[Product Group]
       ,[Dim Product2].[Summary]
       ,[Dim Time].[Open Hour Bucket].ALLMEMBERS
      )
    } ON ROWS
FROM [theyseemecubin]
WHERE 
  {
    (
      [Dim Store2].[Store Key].&[1046]
     ,[Dim Date].[Calender].[Date].&[2014-11-20]
    )
  };
您不需要大括号,因为只有元组就足够了:

SELECT 
  NON EMPTY 
    {
      [Measures].[Quantity]
     ,[Measures].[Total Price]
     ,[Measures].[Margin]
     ,[Measures].[Profit Margin]
    } ON COLUMNS
 ,NON EMPTY 
    {
      (
        [Dim Product2].[Product Group]
       ,[Dim Product2].[Summary]
       ,[Dim Time].[Open Hour Bucket].ALLMEMBERS
      )
    } ON ROWS
FROM [theyseemecubin]
WHERE 
    (
      [Dim Store2].[Store Key].&[1046]
     ,[Dim Date].[Calender].[Date].&[2014-11-20]
    );
元组是逻辑的,因此它等价于sql。如果你想做一个逻辑运算,或者你需要改变一些事情,并利用一个集合


也许有一件事需要检查——这确实是会员的全名吗?【暗淡日期】【日历】【日期】和【2014-11-20】。。。大多数mdx工具SSMS和MDXstudio您应该能够将成员拖放到查询窗格中查看全名。

尝试将[Dim Date].[Calendar].[Date]移动到行部分,以便查看所有非空日期。它是否返回2014-11-20成员?@whyteq阅读您的代码就像诗歌。我会保证以后的格式是这样的——看起来很整洁。我将我的代码调整为你的,然后我就可以解决我的问题了。这是由于元组的误解,所以再次感谢@Cenderze很多人都会一言不发,接受表扬——但漂亮的代码格式取决于我按下免费应用程序MdxStudio中的“格式代码”按钮!肯定会让事情更清楚。