Description:
This function returns the index of the current member in dimension.
Syntax: CURRENTINDEX (Dimension)
Remarks
Example
The CURRENTINDEX function can be used in any database where you want to access the index number corresponding to the current member in a given dimension. It is most commonly used in the cases where one dimension and its member's indexes are needed to populate or reference or read another dimension with a different name. In such cases of Cross-Cube Formulas or simple data allocation, the CURRENTINDEX function can be used to point to the current member of a dimension. This function returns the index of the current member that is pointed to. The result of the function can be used either as a reference for an outer formula or it can be used as a value to populate a fact data point. A Cross-Cube formula can use the result of this function to reference the data point where it should write values.
=CURRENTINDEX ("Time") |
-returns the "Index" number of the current member in the dimension named "Time" from the database where the formula is written. This function returns the value 12 which is the currently selected member. |
=CURRENTINDEX ("Version") |
-returns the index of the current member of the dimension "Version" which is the index for the currently selected member "Budget" The function returns the value 2 which is the index for the member "Budget". |
Let us take the example of a database in PowerOLAP where we are populating values into a member calculating it reading from the index of the member accessed in the current function. The accessed index in this case is used to facilitate calculation of a third value that is to populate the result of the formula. We shall use this example in this case to populate a value into a cube that uses the value of the current member index from a specified dimension as a fact value to populate its own members within its own dimension. The current member's index from one dimension becomes a reference for a value that is used to calculate the fact data point for another member in another dimension or it can be the value itself in the same cube or a different cube. This function can also be used to identify the member whose value should be pulled into the formula. A numeric value signifying the index for the current member name is returned as the result for the CURRENTINDEX function.
The formula above writes values to the "Balance Sheet" cube to the "BS Month" dimension into the member named "Jan vs Dec Prior Year" which as the name suggests aims to calculate the difference between balances for December of one year and the January of the next year. The formula has a condition which states that if the currently selected year is 1997 then the value for the above mentioned member is "0" else, the value for the "Jan vs Dec.." is the difference between the January of the current year and December of the prior year and the difference is multiplied by "Natural Balance". The Prior Year is ascertained by using the Member function for the member whose Index is 1 less than the index of the currently selected year.