0
votes

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.

1
you can answer your own question, or delete it - as it stands it is a little in limbo.whytheq
I had to wait some time before being able to answer my own question. Thanks.johnc

1 Answers

0
votes

UPDATE: Is seems that i needed to use [Domain].[Domain].properties('Value') instead of [Domain].[Domain].[Value]

SOLVED