I am trying to write an MDX query which selects top 100 rows by dimension or measure value.
Fragment on a query
NonEmpty([Domain].[Domain].[Domain].Members , { [Measures].[Total - Domains] } )
I can use topcount and get top 100 rows by "order_count" measure successfully:
topcount(NonEmpty([Domain].[Domain].[Domain].Members , { [Measures].[Total - Domains] } ), 100, [Measures].[order_count])
However, when i try to do that on the dimension value, it does not seem to work properly it seems like it is not doing sorting operation):
topcount(NonEmpty([Domain].[Domain].[Domain].Members , { [Measures].[Total - Domains] } ), 100, [Domain].[Domain].[Value])
I have read that topcount expects numeric expression to sort and my domain value is a string, so I have tried using head() and order(), but I still get incorrect results.