子选择仅支持COLUMNS轴

时间:2017-01-12 07:02:02

标签: mdx msbi

子选择仅支持COLUMNS轴。

SELECT  NON EMPTY {  [Measures].[Total Due] } ON COLUMNS,
TopCount ({[Store].[Name].Members *[Customer].[Store ID 1].Members }
,5,
[Measures].[Total Due]) ON ROWS
FROM [TOP_5]

1 个答案:

答案 0 :(得分:0)

根据需要选择支持多个轴 - 事实上,子选择是实际使用两个以上轴的场合之一。

SELECT 
  [Sales Territory].[Sales Territory Region].MEMBERS ON 0
 ,[Date].[Calendar].[Calendar Year].MEMBERS ON 1
FROM 
( //<< subselect starts here
  SELECT 
    [Sales Territory].[Sales Territory Region].[Canada] ON 0
   ,[Product].[Product].[Mountain-200 Black, 42] ON 1
   ,[Promotion].[Promotion Type].[No Discount] ON 2
   ,[Date].[Calendar].[Calendar Year].[CY 2008] ON 3
  FROM [Adventure Works]
) //<< subselect ends here
WHERE 
  [Measures].[Sales Amount];

您是否尝试过WITH子句

WITH SET [X] AS
  TopCount (
     {[Store].[Name].Members *[Customer].[Store ID 1].Members }
     ,5
     ,[Measures].[Total Due]
  ) 
SELECT  
   NON EMPTY {  [Measures].[Total Due] } ON COLUMNS,
   [X] ON ROWS
FROM [TOP_5];