MicroStrategy ONE
How to Define Relationships Between Attributes
Attribute relationships are associations between attributes that specify how attributes are connected. Attribute relationships define how tables and columns are joined and used, and which tables are related to other tables. Without relationships, there is no interaction between data, and therefore no logical structure. The relationships give meaning to the data by providing logical associations of attributes based on business rules.
Every attribute relationship has two parts—a parent and a child. A child must always have a parent and a parent can have multiple children. The parent attribute is at a higher logical level than the child.
In a relationship between Year and Quarter, Year is the parent attribute and Quarter is the child.
Relationship types are defined by the attribute elements that exist in the related attributes. Each type is described below:
-
One-to-one: Each element in the parent attribute corresponds to one and only one element in the child attribute, and each child attribute corresponds to one and only one element in the parent attribute.
A citizen can have only one taxpayer ID and a taxpayer ID can be assigned to only one citizen.
-
One-to-many: Each element in the parent attribute corresponds to one or more elements in the child attribute, and each child attribute corresponds to one and only one element in the parent attribute.
Year has a one-to-many relationship to quarter. One year has many quarters, but a specific quarter can be in one year only. This assumes that quarters are defined with an accompanying year such as Q4 2017, Q1 2018, etc.
-
Many-to-many: Each element in the parent attribute can have multiple children and each child element in the child attribute can have multiple parents.
In banking, customers and accounts are an example of a many-to-many relationship. One customer can have many accounts, and each account can be associated with many customers, such as in the case of a joint checking account.
New relationships are user-managed by default. User-managed relationships become auto-managed when you modify the relationships on the Define Relationships dialog.
The difference between user-managed relationships and auto-managed relationships is that invalid auto-managed relationships are deleted automatically after the dataset is published, while user-managed relationships are not.
In this example, the one-to-one relationship between YEAR and MONTH is invalid. After publishing the dataset, an error icon appears to the right of the relationship.
Since new relationships are user-managed by default, click Convert All and select To auto managed. Click Save.
Edit the dataset again, notice the invalid relationship is now deleted because the relationship was changed to auto-managed.
To Define Relationships Between Attributes
- Create a blank dossier or open an existing one.
-
Choose Add Data > New Data to import data into a new dataset.
or
In the Datasets panel, click More next to the dataset name and choose Edit Dataset to add data to the dataset. The Preview Dialog opens. Click Add a new table.
The Data Sources dialog opens.
- Select the data you want to import, according to your data source type.
- Once you have selected the data you want to import, click Prepare Data to open the Preview dialog.
-
In the top pane, click the drop-down arrow for the table you want to modify and choose Define Relationships. The Define Relationships dialog opens.
- Click Add New to add a new blank relationship.
- Select the parent attribute from the Parent Attribute drop-down for the new relationship. The parent attribute is at a higher level than the child.
- Select the child attribute from the Child Attribute drop-down.
-
Select a relationship type from the Relationship drop-down. The relationship is defined as one to many, by default.
- Select One to One to ensure that each element in the parent attribute corresponds to only one element in the child attribute. Each child attribute corresponds to only one element in the parent attribute.
- Select One to Many to ensure that each element in the parent attribute corresponds to one or more elements in the child attribute. Each child attribute corresponds to only one element in the parent attribute.
- Select Many to Many to ensure that each element in the parent attribute can have multiple children. Each child element in the child attribute can have multiple parents.
-
You can edit relationships by changing the Parent Attribute, Child Attribute, and Relationship options. Modifying a relationship converts it to an auto-managed relationship and changes the toggle button from to .
- Select the toggle button to convert a relationship to user or auto managed.
- You can convert all relationships to user or auto managed by selecting the appropriate option from the Convert All drop-down.
- To delete a relationship, select the corresponding to the right of the Relationship drop-down.
- Click Save.