CubeFields.GetMeasure procedure builder

CubeFields.GetMeasure (Excel)

Given an attribute hierarchy, returns an implicit measure for the given function that corresponds to this attribute. If an implicit measure does not exist, a new implicit measure is created and added to the CubeFields collection.

Getting a measure by using the GetMeasure function will work for these functions only: Count, Sum, Average, Max, and Min. For example, these will work:

GetMeasure (AttributeHierarchy, Function, Caption)

Dim cbfGetMeasure As CubeField
Set cbfGetMeasure = ActiveCell.PivotTable.CubeFields.GetMeasure(AttributeHierarchy:=xlHierarchy, Function:=xlAverage)

Arguments

The following arguments are required:

AttributeHierarchy (XlCubeFieldSubType) - The unique cube field that is an attribute hierarchy (XlCubeFieldType = xlHierarchy, and XlCubeFieldSubType = xlCubeAttribute).


Here you can find possible values for .

XlCubeFieldSubType

Function (XlConsolidationFunction) - The function performed in the added data field.


Here you can find possible values for .

XlConsolidationFunction

Optional arguments

The following argument is optional

Caption - The label used in the PivotTable report to identify this measure. If the measure already exists, Caption will overwrite the existing label of this measure

Caption - The label used in the PivotTable report to identify this measure. If the measure already exists, Caption will overwrite the existing label of this measure