MicroStrategy ONE

NTileSize

NTileSize distributes the values in the specified metric, sorted in either ascending or descending order, with the same number of elements in each bucket. The number of elements in each bucket is user-defined. This is an OLAP function.

Syntax

NTileSize <Ascending, BreakBy> (Argument, Size)

Where:

  • Ascending is a TRUE/FALSE parameter that designates the organization of data within the NTiles.
  • BreakBy is the parameter that sets the attribute determining where the calculation restarts.
  • Argument is a metric representing a list of values to be distributed in buckets.
  • Size is a positive integer that designates the number of elements per bucket.

Example

Example 1: If you define the Size as 2, the function returns buckets containing two values each. If there are six values, values one and two go in bucket 1, values three and four go in bucket 2, and values five and six go in bucket 3.

Example 2: This example shows a report where the customer states are sorted by revenue and then placed in buckets based on the number of elements that can fit in a bucket. The number of elements per bucket size is defined as 8. The report includes the attribute Customer State and the metrics Total Revenue and NTileSize. The syntax for the NTileSize metric is as follows:

NTileSize ([Total Revenue],8)

The resulting report divides the 48 states into 6 buckets each containing 8 elements (states). A portion of the resulting report displays as follows.