I have a fact table with structure:
(objectid, fromLoc, toLoc, duration)
I need the equivalent MDX for the following SQL:
select fromLoc, toLoc, max(duration) from fact group by fromLoc, toLoc;
I tried with the following MDX but it's showing wrong results. It's showing sum(duration) instead of showing max value for each grouping:

  MEMBER [Measures].[MaxValue] AS
-- Also tried max(FromLoc.members, [Measures].[Duration]) 
-- Also tried  max(Object.objectid.members, [Measures].[Duration])
 select FromLoc.members on axis(1),
toLoc.members  on axis(0)
from [cube1]
where [Measures].[MaxValue]
In all cases it shows the same result which is the sum of duration per group.
Please help me by providing the correct MDX which can answer the queries like the above SQL.