Edytuj

Udostępnij za pośrednictwem


CalculatedMembers.AddCalculatedMember Method

Definition

Adds a calculated field or calculated item to a PivotTable.

public Microsoft.Office.Interop.Excel.CalculatedMember AddCalculatedMember (string Name, object Formula, object SolveOrder, object Type, object DisplayFolder, object MeasureGroup, object ParentHierarchy, object ParentMember, object NumberFormat);
Public Function AddCalculatedMember (Name As String, Formula As Object, Optional SolveOrder As Object, Optional Type As Object, Optional DisplayFolder As Object, Optional MeasureGroup As Object, Optional ParentHierarchy As Object, Optional ParentMember As Object, Optional NumberFormat As Object) As CalculatedMember

Parameters

Name
String

The name of the calculated member.

Formula
Object

The formula of the calculated member.

SolveOrder
Object

The solve order for the calculated member.

Type
Object

The type of calculated member.

DisplayFolder
Object

A folder that exists to display calculated measures.

MeasureGroup
Object

The group to which the calculated belongs.

ParentHierarchy
Object

The parent path of the ParentMember.

ParentMember
Object

The parent of the calculated member.

NumberFormat
Object

The format of numbers used for calculated members.

Returns

Remarks

The Formula argument must have a valid MDX (multidimensional expression) syntax statement. The Name argument has to be acceptable to the Online Analytical Processing (OLAP) provider.

  • DisplayFolder: Display folders are only valid for calculated measures. They are not valid for calculated members. The string can have semicolons ; in it. Semicolons designate multiple display folders. For example, if you use the string my folder1;myfolder2 then the calculated measure will show in two display folders one named myfolder1 the other named ‘myfolder2’. The string can have backslashes \. This designates a hierarchical path for the display folder. For example, if you use the string welcome\to\seattle there will be a display folder called welcome that contains a display folder called to which contains a display folder called seattle. Display folders are virtual folders.  They do not really exist in the same sense that we think of system folders. They only exist for purposes of displaying the calculated measures.
  • NumberFormat: The number formats can only be set by macros. There is no user interface for setting them. This is the only property that cannot be set via the user interface. The type is always xlNumberFormatTypeDefault when a calculated member is created via the user interface. The number formats are only valid for calculated members. They are not valid for calculated measures.
  • ParentHierarchy: The parent hierarchy can be any valid MDX hierarchy. Parent hierarchies are only valid for calculated members. They are not valid for calculated measures. If a parent member is chosen that is in a different parent hierarchy, the parent hierarchy will be automatically changed to match the parent hierarchy of the parent member.

Applies to