Share via


BottomCount

Returns the specified number of bottom-most rows, in increasing order of rank as specified by an expression.

Syntax

BottomCount(<table expression>, <rank expression>, <count>)

Applies To

An expression that returns a table, such as a <table column reference>, or a function that returns a table.

Return Type

<table expression>

Remarks

The value that is supplied by the <rank expression> argument determines the increasing order of rank for the rows that are supplied in the <table expression> argument, and the number of bottom-most rows that is specified in the <count> argument is returned.

Examples

The following example returns the predicted state of the Bike Buyer column in a singleton query. The query also returns the bottom two least likely states of the Bike Buyer attribute, based on the adjusted probability determined by the PredictHistogram function.

SELECT
  [TM Decision Tree].[Bike Buyer],
  BottomCount(PredictHistogram([Bike Buyer]),$AdjustedProbability,2)
From
  [TM Decision Tree]
NATURAL PREDICTION JOIN
(SELECT 28 AS [Age],
  '2-5 Miles' AS [Commute Distance],
  'Graduate Degree' AS [Education],
  0 AS [Number Cars Owned],
  0 AS [Number Children At Home]) AS t

See Also

Reference

Data Mining Extensions (DMX) Function Reference
Functions (DMX)
Mapping Functions to Query Types (DMX)

Help and Information

Getting SQL Server 2005 Assistance