Axis0函数需要参数的元组集表达式

时间:2015-04-01 07:46:04

标签: ssas mdx olap ssas-2012

我只是希望3月份的销售额与销售额截然不同。我收到了这个MDX查询。

我的MDX查询:

select 
distinctcount([Measures].[Sales #]) on columns,
--[Measures].[Sales #] on columns,
non empty ([Customer].[Store Group].[Store Group]) on rows
from
(
select 
{
    [Calendar].[Month].[March 2015]
}
ON columns
from [F1_SalesBI])

但每当我尝试执行此操作时,我都会收到以下错误。

Executing the query ...
The Axis0 function expects a tuple set expression for the  argument. A string or numeric expression was used.
Execution complete

1 个答案:

答案 0 :(得分:0)

以下是msdn的定义: https://msdn.microsoft.com/en-us/library/ms145519.aspx

语法:

  

DistinctCount(Set_Expression)

当您使用Measures作为参数时,您正在执行此操作:

DistinctCount(Numeric_Expression)

以下内容应该可以运行正常:

WITH 
  SET [mySet] AS 
    [Customer].[Store Group].[Store Group] * {[Measures].[Sales #]} 
  MEMBER [Measures].[setDistCount] AS 
    DistinctCount([mySet]) 
SELECT 
  {
    [Measures].[setDistCount]
   ,[Measures].[Sales #]
  } ON 0
 ,NON EMPTY 
    [Customer].[Store Group].[Store Group] ON 1
FROM 
(
  SELECT 
    {[Calendar].[Month].[March 2015]} ON 0
  FROM [F1_SalesBI]
);

要返回当月发票的数量,请尝试以下操作:

WITH 
  SET [mySet] AS 
    {[Calendar].[Month].[March 2015]}  * {[Measures].[Sales #]} 
  MEMBER [Measures].[setDistCount] AS 
    DistinctCount([mySet]) 
SELECT 
  {
    [Measures].[setDistCount]
  } ON 0
FROM [F1_SalesBI];

如果上述内容返回1,则尝试通过此脚本检查该集:

SELECT 
  {} on 0,
  {[Calendar].[Month].[March 2015]}  * {[Measures].[Sales #]}  ON 0
FROM [F1_SalesBI];

这只会返回1个成员吗?

这个怎么样(没有围绕测量设置括号)?:

SELECT 
  {} on 0,
  {[Calendar].[Month].[March 2015]}  * [Measures].[Sales #]  ON 0
FROM [F1_SalesBI];