CalculatedMembers.Add Method
Excel Developer Reference |
Adds a calculated field or calculated item to a PivotTable. Returns a CalculatedMember object.
Syntax
expression.Add(Name, Formula, SolveOrder, Type)
expression A variable that represents a CalculatedMembers object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Name | Required | String | The name of the calculated member. |
Formula | Required | String | The formula of the calculated member. |
SolveOrder | Optional | Variant | The solve order for the calculated member. |
Type | Optional | Variant | The type of calculated member. |
Return Value
A CalculatedMember object that represents the new calculated field or calculated item.
Remarks
The Formula argument must contain a valid MDX (Multidimensional Expression) syntax statement. The Name argument has to be acceptable to the Online Analytical Processing (OLAP) provider and the Type argument has to be defined.
If you set the Type argument of this method to xlCalculatedSet, then you must call the AddSet method to make the new field set visible in the PivotTable.
Example
The following example adds a set to a PivotTable.
Note |
---|
Connection to the cube and existing pivot table is necessary for the sample to run. |
Visual Basic for Applications |
---|
|
See Also