views:

26

answers:

2

I have an OLAP cube containing the sales count for each of my shops.

Using MDX, how can I output the rank of a given shop?

I am dreaming about something like below (does not work), it would return 8 if SomeShop is the 8th most-selling shop:

SELECT RANK( [Shop].CHILDREN, [Shop].[SomeShop]) from [Sales]
A: 

You should check out the examples on msdn, the last example will work here.
Something like this:

WITH MEMBER [Measures].[rank] AS RANK( [Shop].CurrentMember, [Shop].MEMBERS)
SELECT {[Measures].[rank], ...} on 0
ORDER([Shop].MEMBERS, [Measures].[rank], ASC) on 1
FROM [Sales]
Adam