Description:
This function returns the total number of levels in a specified dimension.
Syntax: LEVELCOUNT (Dimension)
Remarks
Example
The LEVELCOUNT function can be used in any database where you want to access members in a given dimension and the value for "level-count" can either used as a reference in a formula or it can be used to as a fact data value into to populate another member.
This function returns the number of levels corresponding to the count of total number of levels in a specified dimension.
=LEVELCOUNT ("Time") |
- returns the number of levels existing in the dimension named "Time" in the PowerOLAP database where the formula is written. This function returns the value 4 which is the count of the total number of levels in the hierarchy structure of the given dimension. |
=LEVEL ("Version", "Current Budget") |
- returns the number of levels existing in the dimension named "Version" in the PowerOLAP database where the formula is written. This function returns the value 0 which is the count of the total number of levels in the given dimension. Since it has no hierarchy there are no levels. |
Note: A number supplied within double quotes is taken as a string parameter.
Let us take the example of a database in PowerOLAP where we have dimensions and hierarchies and it is the count of the levels within these hierarchies which is to be accessed by this function for reading the number of levels, and assigning that value as fact data to another member. We shall use this example in this case to populate a value into a cube that uses the count of levels in a hierarchy / hierarchies {of a specified dimension} as a fact value to populate its own members within its own dimension. The count of levels from one dimension becomes the fact data for another member in another dimension and the value is pulled from one through to another, with the use of the "LEVELCOUNT" function.
A numeric value signifying the count of members is the number that is returned as the result for the LEVELCOUNT function. The formula above writes values into the "Company" cube to the "Company Info" dimension into the member named "Dimension-LOAN-LevelCount" by creating the appropriate value for this member based upon the parameter that is given as input to this function. The input parameter here is the dimension name which is namely the "LOAN" dimension and the hierarchy of this dimension is accessed and the count of the levels in that hierarchy is ascertained through this function. The count in number of the levels referenced through the dimension in this function is the value returned by this function.