How do you get the total row count in an MDX query to use for paging?

Respondido How do you get the total row count in an MDX query to use for paging?

  • Wednesday, April 25, 2012 8:41 AM
     
      Has Code
     am attempting to implement paging to large datasets in MDX (SSAS).

    I have the following to retrieve paged data which works fine:

    SELECT 
    { 
      [Measures].[Mesasure1],
      [Measures].[Measure2]
    } ON COLUMNS, 
    SUBSET
    (
      ORDER 
      (
        {
          (
            [Item].[Category].ALLMEMBERS
          )
        }, NULL, BASC
      ), 10, 50  --10 = start index, 50 = returned roes
    ) 
    ON ROWS
    FROM ( SELECT ( { [Time].[Date].&[2012-04-15T00:00:00]:[Time].[Date].&[2012-04-20T00:00:00] } ) ON COLUMNS
    FROM [DataMartPerformance]
    ))
    

    However I cannot for the life of me find anywhere on the internet that helps explain how to get the total rows available.  Do I do it in a seperate query? If so how? Or can I wrap it into this one query somehow?

All Replies

  • Wednesday, April 25, 2012 12:52 PM
     
      Has Code

    I have done more work on this and have got this:

    SELECT 
      { 
        [Measures].[Measure1],
        [Measures].[Measure2],
        [Measures].[RowCount]
      } ON COLUMNS
    FROM(
      WITH MEMBER [Measures].[RowCount]
        AS Axis(1).Count
      SELECT 
      { 
        [Measures].[Measure1],
        [Measures].[Measure2],
        [Measures].[RowCount]
      } ON COLUMNS, 
      { 
        (
          [Item].[Partner].[Partner]
        )
      }
      ON ROWS
      FROM (SELECT ( { [Time].[Date].&[2012-01-25T00:00:00]:[Time].[Date].&[2012-04-24T00:00:00] } ) ON COLUMNS 
      FROM [DataMartPerformance]
      )
    )
    

    This doesn't work as you cannot define new calculations in subset. But I wondered perhaps if there is a way to get the number of items that are in the subset? If I can calculate that then I should have everything I need.

    Any help?

  • Saturday, April 28, 2012 10:15 AM
     
     

    Does anyone know if this is possible?

    It seems to me like its something that should be easy, but really struggling..

  • Monday, April 30, 2012 9:26 PM
     
     Answered