Class Calendar
- Inheritance
-
Calendar
- Implements
- Inherited Members
- Namespace
- TabularEditor.TOMWrapper
- Assembly
- TOMWrapper.dll
Defines a logical calendar as part of the DAX Time-Intelligence support.
public sealed class Calendar : TabularNamedObject, ICustomTypeDescriptor, INotifyPropertyChanging, IComparable, ITabularTableObject, ITabularObjectContainerObject, IDescriptionObject, ILineageTagObject, IClonableObject, IDaxObject, ITabularNamedObject, ITabularObject, INotifyPropertyChanged, IHandlerObject, INamedObject
- Extension Methods
Remarks
This metadata object is only supported when the compatibility level of the database is at 1701 or above.
Properties
CalendarColumnGroups
The collection of CalendarColumnGroup objects on this Calendar.
public CalendarColumnGroupCollection CalendarColumnGroups { get; }
Property Value
| Type | Description |
|---|---|
| CalendarColumnGroupCollection |
ColumnMappings
The collection of column mappings that define the calendar's time unit associations. This is an alias for CalendarColumnGroups.
public CalendarColumnGroupCollection ColumnMappings { get; }
Property Value
| Type | Description |
|---|---|
| CalendarColumnGroupCollection |
DaxObjectFullName
Gets a string that may be used for referencing the caæemdar in a DAX expression.
[Browsable(false)]
public string DaxObjectFullName { get; }
Property Value
| Type | Description |
|---|---|
| string |
DaxObjectName
Gets a string that may be used for referencing the calendar in a DAX expression.
[Browsable(false)]
public string DaxObjectName { get; }
Property Value
| Type | Description |
|---|---|
| string |
DaxTableName
Gets a string that may be used for referencing the calendar in a DAX expression.
[Browsable(false)]
public string DaxTableName { get; }
Property Value
| Type | Description |
|---|---|
| string |
Description
The description of the Calendar, visible to developers at design time and to administrators in management tools, such as SQL Server Management Studio.
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
LineageTag
A tag that represents the lineage of the object.
public string LineageTag { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Lineage tags enable stable identification of objects across different semantic models. Using lineage tags enables Power BI features such as composite models to maintain their binding to referenced tables or columns, even if the source semantic model object is renamed.
Parent
The parent Table of the current Calendar.
public Table Parent { get; }
Property Value
| Type | Description |
|---|---|
| Table |
ReferencedBy
Gets the list of objects that reference this calendar based on their DAX expressions.
[Browsable(false)]
public ReferencedByList ReferencedBy { get; }
Property Value
| Type | Description |
|---|---|
| ReferencedByList |
SourceLineageTag
A tag that represents the lineage of the source for the object.
public string SourceLineageTag { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Table
The parent table of the current Calendar.
[Browsable(false)]
public Table Table { get; }
Property Value
| Type | Description |
|---|---|
| Table |
Methods
AddTimeUnit(TimeUnit, Column, params Column[])
Adds a new time unit association to the calendar.
public TimeUnitColumnAssociation AddTimeUnit(TimeUnit timeUnit, Column primaryColumn, params Column[] associatedColumns)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeUnit | timeUnit | The unit of time |
| Column | primaryColumn | The primary column to associate with this time unit |
| Column[] | associatedColumns | Additional associated columns (i.e. columns representing the same time unit as the primary column in other formats, languages, etc.) |
Returns
| Type | Description |
|---|---|
| TimeUnitColumnAssociation |
Exceptions
Clone(string, Table)
Creates an exact copy of this Calendar object.
public Calendar Clone(string newName = null, Table newParent = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | newName | |
| Table | newParent |
Returns
| Type | Description |
|---|---|
| Calendar |
CreateNew(Table, string)
Creates a new Calendar and adds it to the parent Table. Also creates the underlying metadataobject and adds it to the TOM tree.
public static Calendar CreateNew(Table parent, string name = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Table | parent | |
| string | name |
Returns
| Type | Description |
|---|---|
| Calendar |
DeleteTimeUnit(TimeUnit)
Removes the specified time unit association from the calendar.
public bool DeleteTimeUnit(TimeUnit timeUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeUnit | timeUnit |
Returns
| Type | Description |
|---|---|
| bool |
FindTimeUnit(TimeUnit)
Finds the time unit association for the specified time unit. Returns null if no association exists for the specified time unit.
public TimeUnitColumnAssociation FindTimeUnit(TimeUnit timeUnit)
Parameters
| Type | Name | Description |
|---|---|---|
| TimeUnit | timeUnit |
Returns
| Type | Description |
|---|---|
| TimeUnitColumnAssociation |
GetTimeUnits()
Returns all time unit associations in the calendar.
public IEnumerable<TimeUnitColumnAssociation> GetTimeUnits()
Returns
| Type | Description |
|---|---|
| IEnumerable<TimeUnitColumnAssociation> |
OnPropertyChanged(string, object, object)
Fired after a property is changed
protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | propertyName | |
| object | oldValue | |
| object | newValue |
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.
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. |