Min function (MDX)

The Min function finds the smallest value in a specified set.

Returns: A number.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-Min--(--SetExpression--+----------------------+--)----------><
                          '-,--NumericExpression-'      

Parameters

SetExpression
Specifies a set of tuples across which the minimum is to be found.
NumericExpression
Specifies a numeric expression that, when applied to each tuple in the set, gives the values whose minimum is to be found. This expression is typically a measure.

If you do not provide this parameter, the Min function determines the expression to use based on the other elements of the SELECT statement in which it occurs.

Example

In this example, you want see in which months your stock was the lowest for each month in 2002. To calculate this, you need to set the value for a month to be the same as the minimum value of the values for the days of the month.

The following query uses the Min function to return the number of items and minimum number of items for each month in the year 2002. The number of items is the sum of the number of items for the days in the month and the minimum number of items is the smallest value found among the number of items for the days in the month.

Query
WITH 

MEMBER [Price Analysis].[Measures].[Minimum Number Of Items] 

   AS Min(Descendants([Price Analysis].[Time].CurrentMember, 

   [Price Analysis].[Time].[Day of Calendar Month Level (Price Analysis)]), 

   [Price Analysis].[Measures].[Number Of Items])

SELECT {[Price Analysis].[Measures].[Number Of Items], 

   [Price Analysis].[Measures].[Minimum Number Of Items]}  

   ON AXIS(0),

   {Descendants([Price Analysis].[Time].[All Time (Calendar)].[2002], 

   [Price Analysis].[Time].[Calendar Month Level (Price Analysis)])}

   ON AXIS(1)

FROM [Price Analysis]
Result
Time Number of items Minimum number of items
1 6872 160
2 8830 207
3 2845 49
4 3090 37
5 2383 35
6 3194 34
7 3932 75
8 3188 40
9 3127 44
10 2998 55
11    
12    

Related functions

The Min function is a member of a family of aggregating functions: Aggregate, Avg, Median, Max, Sum.



Feedback | Information roadmap