Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Sorts a set in ascending order, and returns the specified number of tuples in the specified set with the lowest values.
If a numeric expression is specified, this function sorts the tuples in the specified set according to the value of the specified numeric expression as evaluated over the set, in ascending order. The BottomCount function then returns the specified number of tuples with the lowest value.
The BottomCount function, like the TopCount function, always breaks the hierarchy.
If a numeric expression is not specified, the function returns the set of members in natural order, without any sorting, behaving like the Tail (MDX) function.
The following example returns the Reseller Order Quantity measure by for each calendar year for the bottom five Product SubCategory sales, ordered based on the Reseller Sales Amount measure.
SELECT BottomCount([Product].[Product Categories].[Subcategory].Members , 10 , [Measures].[Reseller Sales Amount]) ON 0, [Date].[Calendar].[Calendar Year].Members ON 1 FROM [Adventure Works] WHERE [Measures].[Reseller Order Quantity]