MDX - ORDER后行计数为1

时间:2015-08-28 09:42:44

标签: sql count ssas mdx

我有一个MDX查询,如下所示:

WITH
SET selection as ([Dates].[Year].&[2014],[Dates].[Month].&[1])        
set testset as (selection, [ThroughputID].[ID].ALLMEMBERS)

MEMBER [Measures].[RowCount] AS COUNT (testset)

SELECT
selection ON 0,
[Measures].RowCount
ON 1
FROM (SELECT [Dates].[Y-H-Q-M].MEMBERS ON 0 FROM [Throughput])

RowCount给出1182918

如果我将ORDER添加到“testset”,如下所示,RowCount给出1,为什么会这样?

WITH
SET selection as ([Dates].[Year].&[2014],[Dates].[Month].&[1])        
set testset as ORDER(selection, [ThroughputID].[ID].ALLMEMBERS)

MEMBER [Measures].[RowCount] AS COUNT (testset)

SELECT
selection ON 0,
[Measures].RowCount
ON 1
FROM (SELECT [Dates].[Y-H-Q-M].MEMBERS ON 0 FROM [Throughput])

1 个答案:

答案 0 :(得分:1)

请尝试此操作,然后您可以检查数据以了解更改:

WITH 
  SET selection AS 
    (
      [Dates].[Year].&[2014]
     ,[Dates].[Month].&[1]
    ) 
  SET testset AS 
    Order
    (
      selection
     ,[ThroughputID].[ID].ALLMEMBERS
    ) 
SELECT 
  {} ON 0
 ,testset ON 1
FROM 
(
  SELECT 
    [Dates].[Y-H-Q-M].MEMBERS ON 0
  FROM [Throughput]
);

我怀疑你脚本的这一部分失败并解析为一个成员:

  Order
    (
      selection
     ,[ThroughputID].[ID].ALLMEMBERS
    ) 

Order的第二个参数通常是数字 - 你使用了一个集合。