Maximum value of a measure from an MDX result set

Below is an MDX Query which returns the sales of different product categories:

select {[Dim Category].[Category].[Category]} on 1,
{[Measures].[Measure Value]} on 0
from [MY CUBE]

result set returned:

We can see that the maximum value is 42092.83. Using max and axis function, we can show the maximum value as a seperate measure. So, we add a measure and the query becomes :

member [Measures].[MAXSales]
max(axis(1),[Measures].[Measure Value])

select {[Dim Category].[Category].[Category]} on 1,
{[Measures].[Measure Value],[Measures].[MAXSales]} on 0
from [MY CUBE]

the result set looks like this:

3 thoughts on “Maximum value of a measure from an MDX result set

  1. Hi, Thanks very much for this solution. But on using this code my measure value becomes absurd and does not remain same after adding MAX calculated emmber. Please help.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.