共用方式為


CustomRollupExpression (Level Interface)

[!附註]

  下一版的 Microsoft SQL Server 將不再提供此功能。請勿在新的開發工作中使用此功能,並且儘速修改使用此功能的應用程式。

The CustomRollupExpression property of the Level interface contains a Multidimensional Expressions (MDX) expression that is used to override the default rollup mode for the level.

Applies To:clsAggregationLevel, clsCubeLevel, clsDatabaseLevel, clsPartitionLevel

Data Type

String

Access

Access depends on the value of the ClassType property of the object.

Class type

Access

clsDatabaseLevel

R/W

clsCubeLevel

R/W

clsPartitionLevel

R

clsAggregationLevel

R

備註

If the CustomRollupExpression property is blank, member values are rolled up normally using the aggregation function of the current measure. If the property contains an MDX expression, that expression is used to evaluate each member of the level. The formulas contained in this member property are resolved in the same way as regular calculated members.

CustomRollupExpression can be set on both database and cube levels. If set on both types of levels for a given cube, the CustomRollupExpression for the cube level overrides the CustomRollupExpression for the database level. Member-specific rollup expressions in the column specified by the CustomRollupExpression for the level always override this property.

A common usage scenario for this property involves tracking inventory over time. Inventory counts do not aggregate along time dimensions, but they do aggregate along other types of dimensions, such as geography or sales. By defining a CustomRollupExpression property to use the last member of its respective level within a time dimension, closing inventory counts can be rolled up over time.

[!附註]

  Because the DISTINCT COUNT aggregation function does not support custom aggregations, the use of this aggregation function in combination with the CustomRollupExression and CustomRollupColumn properties is not supported. If a cube uses the DISTINCT COUNT aggregation function and any of the dimensions in that cube use either the CustomRollupExpression property or the CustomRollupColumn property then the cube is considered to be invalid. Processing such a cube will raise a validation error with an error code of mderrInvalidCubeDistinctCountWithCustomRollups.

For more information about CREATE MEMBER, see CREATE MEMBER Statement.