Class Measure
Represents a value that is calculated based on an expression. It is a child of a Table object.
Assembly: TOMWrapper.dll
Syntax
public sealed class Measure : TabularNamedObject, ICustomTypeDescriptor, INotifyPropertyChanging, IComparable, IFolderObject, ITabularTableObject, ITomErrorMessageObject, IDescriptionObject, IFormattableObject, ILineageTagObject, IExtendedPropertyObject, ITabularPerspectiveObject, IHideableObject, ITranslatableObject, IAnnotationObject, ISynonymObject, IClonableObject, IDaxObject, ITabularObjectContainer, IDaxDependantObject, IExpressionObject, ITabularNamedObject, ITabularObject, INotifyPropertyChanged, INamedObject
Properties
Annotations
The collection of Annotations on the current Measure.
Declaration
[Browsable(true)]
public AnnotationCollection Annotations { get; }
Property Value
DataCategory
Specifies the type of data contained in the measure so that you can add custom behaviors based on measure type.
Declaration
public string DataCategory { get; set; }
Property Value
DataType
Describes the type of data contained in the column. Possible values are as follows. String (2). Int64 (6). Double (8). DateTime (9). Decimal (10). Boolean (11). Binary (17). Unknown (19) A measure in an error state. Variant (20) A measure with varying data type.
Declaration
[TypeConverter(typeof(DataTypeEnumConverter))]
public DataType DataType { get; }
Property Value
DaxObjectFullName
Gets a valid DAX reference to this measure
Declaration
[Browsable(true)]
public string DaxObjectFullName { get; }
Property Value
DaxObjectName
Gets a valid DAX reference to this measure
Declaration
[Browsable(false)]
public string DaxObjectName { get; }
Property Value
DaxTableName
Gets a valid DAX reference to the table on which this measure resides
Declaration
[Browsable(false)]
public string DaxTableName { get; }
Property Value
DependsOn
Gets the list of objects that this measure depends on.
Declaration
[Browsable(false)]
public DependsOnList DependsOn { get; }
Property Value
Description
The description of the measure, visible to developers at design time and to administrators in management tools, such as SQL Server Management Studio.
Declaration
public string Description { get; set; }
Property Value
DetailRowsExpression
A DAX expression specifying detail rows for this measure (drill-through in client tools).
Declaration
public string DetailRowsExpression { get; set; }
Property Value
DisplayFolder
Defines the display folder for the Measure, for use by clients.
Declaration
public string DisplayFolder { get; set; }
Property Value
ErrorMessage
A string that explains the error state associated with the current object. It is set by the engine only when the state of the object is one of these three values: SemanticError, DependencyError, or EvaluationError. It is applicable only to columns of the type Calculated or CalculatedTableColumn. It will be empty for other column objects.
Declaration
public string ErrorMessage { get; }
Property Value
Expression
The DAX expression that is evaluated for the calculated measure.
Declaration
public string Expression { get; set; }
Property Value
ExtendedProperties
The collection of Extended Properties on the current Measure.
Declaration
public ExtendedPropertyCollection ExtendedProperties { get; }
Property Value
A string that specifies the format of the measure contents. For
Declaration
[TypeConverter(typeof(FormatStringConverter))]
public string FormatString { get; set; }
Property Value
DAX expression that specifies the format of the cell content.
Declaration
public string FormatStringExpression { get; set; }
Property Value
InPerspective
Declaration
[Browsable(true)]
public PerspectiveMeasureIndexer InPerspective { get; }
Property Value
IsHidden
A boolean value that indicates whether the measure is treated as hidden by client visualization tools. True if the measure is treated as hidden by client visualization tools; otherwise false.
Declaration
public bool IsHidden { get; set; }
Property Value
IsSimpleMeasure
A boolean value that indicates whether the measure is an implicit measure that is automatically created by client tools to aggregate a field. Client applications can hide measures that have this flag set.
Declaration
[Browsable(false)]
public bool IsSimpleMeasure { get; set; }
Property Value
IsVisible
Gets the visibility of the Measure. Takes into consideration that a measure is visible regardless of its parent table being visible.
Declaration
[Browsable(false)]
public bool IsVisible { get; }
Property Value
KPI
Gets or sets the KPI of the Measure.
Declaration
public KPI KPI { get; set; }
Property Value
LineageTag
A tag that represents the lineage of the object.
Declaration
public string LineageTag { get; set; }
Property Value
Parent
The parent Table of the current Measure.
Declaration
public Table Parent { get; }
Property Value
ReferencedBy
Gets the list of objects that reference this measure.
Declaration
[Browsable(false)]
public ReferencedByList ReferencedBy { get; }
Property Value
SourceLineageTag
A tag that represents the lineage of the source for the object.
Declaration
public string SourceLineageTag { get; set; }
Property Value
State
Provides information on the state of the measure. Possible values and their interpretation are as follows. Ready (1) The measure is queryable and has up-to-date data. NoData (3) Not applicable to Measure. CalculationNeeded (4) Not applicable to Measure. SemanticError (5) The measure expression has a semantic error. EvaluationError (6) Not applicable to Measure. DependencyError (7) A dependency associated with this measure is in an error state (SemanticError, EvaluationError, or DependencyError). Incomplete (8) Not applicable to Measure. SyntaxError (9) The measure has a syntax error in its expression.
Declaration
public ObjectState State { get; }
Property Value
Synonyms
Collection of localized synonyms for this Measure.
Declaration
[Browsable(true)]
public SynonymIndexer Synonyms { get; }
Property Value
Table
The parent table of the current Measure.
Declaration
[Browsable(false)]
public Table Table { get; }
Property Value
TranslatedDescriptions
Collection of localized descriptions for this Measure.
Declaration
[Browsable(true)]
public TranslationIndexer TranslatedDescriptions { get; }
Property Value
TranslatedDisplayFolders
Collection of localized Display Folders for the current Measure.
Declaration
[Browsable(true)]
public TranslationIndexer TranslatedDisplayFolders { get; }
Property Value
TranslatedNames
Collection of localized names for this Measure.
Declaration
[Browsable(true)]
public TranslationIndexer TranslatedNames { get; }
Property Value
Methods
AddKPI()
Adds a KPI to this measure.
Declaration
Returns
AllowDelete(out string)
Derived classes should override this method to prevent an object from being deleted.
If left un-overridden, always returns TRUE and sets message to null.
Declaration
protected override bool AllowDelete(out string message)
Parameters
Type |
Name |
Description |
string |
message |
If an object CANNOT be deleted, this string should provide
a reason why. If an object CAN be deleted, this string may optionally provide a
suitable warning message that applies if the object is deleted immediately after
the call to CanDelete.
|
Returns
Type |
Description |
bool |
True if an object can be deleted. False otherwise.
|
Overrides
ClearAnnotations()
Removes all annotations from this object.
Declaration
public void ClearAnnotations()
ClearExtendedProperties()
Removes all Extended Properties from this object.
Declaration
public void ClearExtendedProperties()
Clone(string, bool, Table)
Creates an exact copy of this Measure object.
Declaration
public Measure Clone(string newName = null, bool includeTranslations = true, Table newParent = null)
Parameters
Type |
Name |
Description |
string |
newName |
|
bool |
includeTranslations |
|
Table |
newParent |
|
Returns
CreateNew(Table, string)
Creates a new Measure and adds it to the parent Table.
Also creates the underlying metadataobject and adds it to the TOM tree.
Declaration
public static Measure CreateNew(Table parent, string name = null)
Parameters
Returns
CustomReinit()
Declaration
protected override void CustomReinit()
Overrides
GetAnnotation(int)
Gets the value of the annotation with the given index, assuming it exists.
Declaration
public string GetAnnotation(int index)
Parameters
Type |
Name |
Description |
int |
index |
|
Returns
GetAnnotation(string)
Gets the value of the annotation with the given name. Returns null if no such annotation exists.
Declaration
public string GetAnnotation(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
Returns
GetAnnotations()
Gets a collection of all annotation names on the current Measure.
Declaration
public IEnumerable<string> GetAnnotations()
Returns
GetAnnotationsCount()
Gets the number of annotations on the current Measure.
Declaration
public int GetAnnotationsCount()
Returns
GetChildren()
Declaration
public IEnumerable<ITabularNamedObject> GetChildren()
Returns
GetExtendedProperties()
Gets a collection of all ExtendedProperty names on the current object.
Declaration
public IEnumerable<string> GetExtendedProperties()
Returns
GetExtendedProperty(int)
Gets the value of the ExtendedProperty with the given index, assuming it exists.
Declaration
public string GetExtendedProperty(int index)
Parameters
Type |
Name |
Description |
int |
index |
|
Returns
GetExtendedProperty(string)
Gets the value of the ExtendedProperty with the given name. Returns null if no such ExtendedProperty exists.
Declaration
public string GetExtendedProperty(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
Returns
GetExtendedPropertyCount()
Gets the number of ExtendedProperties on the current object.
Declaration
public int GetExtendedPropertyCount()
Returns
GetExtendedPropertyType(int)
Gets the type of the ExtendedProperty with the given index, assuming it exists.
Declaration
public ExtendedPropertyType GetExtendedPropertyType(int index)
Parameters
Type |
Name |
Description |
int |
index |
|
Returns
GetExtendedPropertyType(string)
Gets the type of the ExtendedProperty with the given name, assuming it exists.
Declaration
public ExtendedPropertyType GetExtendedPropertyType(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
Returns
GetNewAnnotationName()
Returns a unique name for a new annotation.
Declaration
public string GetNewAnnotationName()
Returns
GetNewExtendedPropertyName()
Returns a unique name for a new ExtendedProperty.
Declaration
public string GetNewExtendedPropertyName()
Returns
HasAnnotation(string)
Returns true if an annotation with the given name exists. Otherwise false.
Declaration
public bool HasAnnotation(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
Returns
HasExtendedProperty(string)
Returns true if an ExtendedProperty with the given name exists. Otherwise false.
Declaration
public bool HasExtendedProperty(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
Returns
Init()
Derived members should override this method to instantiate child objects
Declaration
protected override void Init()
Overrides
MoveTo(string)
Delete the measure from its current table and create a deep clone (including all translations, if any) in the destination table.
Declaration
public void MoveTo(string destinationTable)
Parameters
Type |
Name |
Description |
string |
destinationTable |
|
Exceptions
MoveTo(Table)
Delete the measure from its current table and create a deep clone (including all translations, if any) in the destination table.
Declaration
public void MoveTo(Table destinationTable)
Parameters
Type |
Name |
Description |
Table |
destinationTable |
|
OnPropertyChanged(string, object, object)
Fired after a property is changed
Declaration
protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
Parameters
Overrides
OnPropertyChanging(string, object, ref bool, ref bool)
Called before a property is changed on an object. Derived classes can control how the change is handled.
Throw ArgumentException within this method, to display an error message in the UI.
Declaration
protected override void OnPropertyChanging(string propertyName, object newValue, ref bool undoable, ref bool cancel)
Parameters
Type |
Name |
Description |
string |
propertyName |
Name of the changed property.
|
object |
newValue |
New value assigned to the property.
|
bool |
undoable |
Return false if automatic undo of the property change is not needed.
|
bool |
cancel |
Return true if the property change should not apply.
|
Overrides
RemoveAnnotation(string)
Remove an annotation by the given name.
Declaration
public void RemoveAnnotation(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
RemoveExtendedProperty(string)
Remove an ExtendedProperty by the given name.
Declaration
public void RemoveExtendedProperty(string name)
Parameters
Type |
Name |
Description |
string |
name |
|
RemoveKPI()
Removes the KPI from this measure.
Declaration
SetAnnotation(int, string)
Sets the value of the annotation with the given index, assuming it exists.
Declaration
public void SetAnnotation(int index, string value)
Parameters
SetAnnotation(string, string)
Sets the value of the annotation having the given name. If no such annotation exists, it will be created. If value is set to null, the annotation will be removed.
Declaration
public void SetAnnotation(string name, string value)
Parameters
SetExtendedProperty(int, string, ExtendedPropertyType)
Sets the value of the ExtendedProperty with the given index, optionally specifiying the type (string or JSON) of the ExtendedProperty.
Declaration
public void SetExtendedProperty(int index, string value, ExtendedPropertyType type)
Parameters
SetExtendedProperty(string, string, ExtendedPropertyType)
Sets the value of the ExtendedProperty having the given name. If no such ExtendedProperty exists, it will be created. If value is set to null, the ExtendedProperty will be removed.
Declaration
public void SetExtendedProperty(string name, string value, ExtendedPropertyType type)
Parameters
ShouldSerializeDetailRowsExpression()
Declaration
public bool ShouldSerializeDetailRowsExpression()
Returns
Implements
Extension Methods