Count

Analysis Services

Analysis Services

Count

Returns the number of items in a collection, depending on the collection.

Syntax
Dimension

Dimensions.Count

Returns the number of dimensions in a cube, including the [Measures] dimension.

Level

«Dimension»|«Hierarchy».Levels.Count

Returns the number of levels in a dimension or hierarchy, including the [All] level if applicable.

Set - Syntax 1

Count(«Set»[, ExcludeEmpty | IncludeEmpty])

Returns the number of cells in a set. This syntax allows empty cells to be excluded or included with the use of the ExcludeEmpty or IncludeEmpty flags, respectively.

Set - Syntax 2

«Set».Count

Returns the number of cells in a set, with empty cells included.

Tuple

«Tuple».Count

Returns the number of dimensions in a tuple.

Note  Empty cells are counted by default. The comparable Count function in OLE DB excludes empty cells by default.

Remarks

To exclude empty cells in the count of a set, use the optional ExcludeEmpty keyword.

Example

If Time has levels Year and Month, and the members of Year are 1994 and 1995, the following examples return 24:

Set - Example 1
Count({Time.Month.Members})
Set - Example 2
Time.Month.Members.Count