TopPercent

Returns the smallest possible subset of a set for which the total results of a numeric evaluation are at least a given percentage. Elements in the result set are listed from largest to smallest.

Syntax

TopPercent ( set, percentage, numeric_value_expression )
ParameterDescription

set

The set from which the top-percentile elements are selected.

percentage

The percentile. This argument must be a value between 0 and 100.

numeric_value_expression

The expression that defines the selection criteria (see MDX Grammar Rules).

Notes

This function ignores negative and missing values.

Example

The following query selects the top-selling markets that contribute 25% of the total yearly Diet products sales, and displays the quarterly sales for each Diet product.

SELECT
 CrossJoin(
           [Product].[Diet].Children, 
           [Year].Children
          )
ON COLUMNS,
 TopPercent(
            [Market].Levels(0).Members,
            25,
            [Product].[Diet]
           ) 
ON ROWS
FROM Sample.Basic
WHERE ([Scenario].[Actual], 
       [Measures].[Sales])

This query returns the grid:

(axis)100-20100-20100-20100-20200-20200-20200-20200-20300-30300-30300-30300-30
(axis)Qtr1Qtr2Qtr3Qtr4Qtr1Qtr2Qtr3Qtr4Qtr1Qtr2Qtr3Qtr4
Illinois75595810508881391152015621402675755859894
California3674915064681658183319541706700802880673
Colorado7008028806735494654125391006921892991