Returns: A number.
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.
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.
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]
| 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 |
The Min function is a member of a family of aggregating functions: Aggregate, Avg, Median, Max, Sum.