Search code examples
sql-server-2012ssasmdx

Extracting second value from ordered list


The following gives me a list of the countries in alphabetical order.

How do I change it so that instead of returning the whole list it just returns the second country in this list? In terms of our cube this would just be the result for the Aland Islands.

SELECT
        ORDER([Geolocation].[Geography].[Geography Country].MEMBERS,
             [Geolocation].[Geography].CurrentMember.name, BASC ) ON ROWS,            
        [Measures].[DefaultMemberName] ON COLUMNS
FROM    [MyCube]

Solution

  • You can use the item function; if I remember well it is 0-based :

    ORDER( [Geolocation].[Geography] ... )(1)