MDX行计数和分页

时间:2016-09-21 15:04:41

标签: sql sql-server ssas mdx

如何翻译此MDX查询以获取所有总记录的计数?在网页上做分页?

SELECT { 
            [Measures].[Invoice Price], 
            [Measures].[Quantity], 
            [Measures].[Verified Total] 
        } 
            on columns, SubSet(
                            NONEMPTY(
                            (
                             [Distributor].[Distributor].[Distributor].ALLMEMBERS * 
                             [Product].[PA Description].[PA Description] * 
                             [Time].[Month Name of Year].[Month Name of Year].ALLMEMBERS *  
                             [Time].[Month Number of Year].[Month Number of Year].ALLMEMBERS 
                             ),
                             {
                                [Measures].[Invoice Price], 
                                [Measures].[Quantity], 
                                [Measures].[Verified Total]

                              }
                             )
                             ,0
                             ,5
                ) 
                DIMENSION PROPERTIES MEMBER_UNIQUE_NAME on Rows from [Reporting]

1 个答案:

答案 0 :(得分:0)

也许是这样的:

WITH MEMBER [Measures].[RowCount] AS
  SubSet(
     NONEMPTY(
       (
        [Distributor].[Distributor].[Distributor].ALLMEMBERS * 
        [Product].[PA Description].[PA Description] * 
        [Time].[Month Name of Year].[Month Name of Year].ALLMEMBERS *  
        [Time].[Month Number of Year].[Month Number of Year].ALLMEMBERS 
       ),
       {
         [Measures].[Invoice Price], 
         [Measures].[Quantity], 
         [Measures].[Verified Total]
       }
     )
     ,0
     ,5
   ).COUNT
SELECT { 
         [Measures].[Invoice Price], 
         [Measures].[Quantity], 
         [Measures].[Verified Total],
         [Measures].[RowCount]
        } on 0
     , SubSet(
     NONEMPTY(
       (
        [Distributor].[Distributor].[Distributor].ALLMEMBERS * 
        [Product].[PA Description].[PA Description] * 
        [Time].[Month Name of Year].[Month Name of Year].ALLMEMBERS *  
        [Time].[Month Number of Year].[Month Number of Year].ALLMEMBERS 
       ),
       {
         [Measures].[Invoice Price], 
         [Measures].[Quantity], 
         [Measures].[Verified Total]
       }
     )
     ,0
     ,5
   ) 
   ON 1 
FROM [Reporting];

虽然肯定只有5 ......!