Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I written MDX query for getting row Number. I got the row_number but i want to retrieve the data between 10 to 15 Records using row_ number column. can u guide me or send snippets

VB
WITH
 MEMBER [Measures].[Row number] AS
   iif( IsError(Axis(0).Count), null,
     Rank (
     StrToTuple ("(" +
      Generate (
       Head ( Axis(1),
        Axis(1).Item(0).Count
       ) AS RN,
       "Axis(1).Item(0).Item(" +
       CStr(RN.CurrentOrdinal - 1) +
       ").Hierarchy.CurrentMember",
       ","
      ) + ")"
     )
     , Axis(1)
    )
   )
SELECT
 {
  [Measures].[Row number],
  [Measures].[# categorytype]
 } ON COLUMNS,
    {
       [category].[category].[category]
    } ON 1
FROM
    [product]
Posted
Comments
Herman<T>.Instance 25-Sep-14 11:09am    
how come I do not see any usage of the row_number() function in SQL Server of your example?

1 solution

MDX queries differs from SQL queries in many aspects...

MSDN wrote:
Important

Unlike the WHERE clause in SQL, the WHERE clause of an MDX SELECT statement never directly filters what is returned on the Rows axis of a query. To filter what appears on the Rows or Columns axis of a query, you can use a variety of MDX functions, for example FILTER, NONEMPTY and TOPCOUNT.

Source:
The Basic MDX Query (MDX)[^] and Specifying the Contents of a Slicer Axis (MDX)[^]

Few interesting information you'll find here: SSAS MDX WHERE clause syntax - filtering multiple values from the same hierarchy[^]

I'm not familiar with MDX queries, but try this WHERE statement:
SQL
WHERE ({[Measures].[Row number].[10], [Measures].[Row number].[11], ..., [Measures].[Row number].[15]})
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900