Читать книгу Excel Power Pivot & Power Query For Dummies - Michael Alexander - Страница 31

Managing existing relationships

Оглавление

If you need to edit or delete a relationship between two tables in your data model, you can do so by following these steps:

1 Open the Power Pivot window, select the Design tab, and then select the Manage Relationships command.

2 In the Manage Relationships dialog box, shown in Figure 2-10, click the relationship you want to work with and click Edit or Delete.If you click Edit, the Edit Relationship dialog box (shown in Figure 2-11) appears. The columns used to form the relationship are highlighted. Here, you can redefine the relationship by simply selecting the appropriate columns. You can also use the Active check box to disable or enable the relationship.


FIGURE 2-10: Use the Manage Relationships dialog box to edit or delete existing relationships.

In Figure 2-9, you see a graphic of an arrow between the list boxes. The graphic has an asterisk next to the list box on the left, and a number 1 next to the list box on the right. The number 1 basically indicates that the model will use the table listed on the right as the source for a unique primary key.

Every relationship must have a field that you designate as the primary key. Primary key fields are necessary in the data model to prevent aggregation errors and duplications. In that light, the Excel data model must impose some strict rules around the primary key.

You cannot have any duplicates or null values in a field being used as the primary key. So the Customers table (refer to Figure 2-9) must have all unique values in the CustomerID field, with no blanks or null values. This is the only way that Excel can ensure data integrity when joining multiple tables.


FIGURE 2-11: Use the Edit Relationship dialog box to adjust the tables and field names that define the selected relationship.

At least one of your tables must contain a field that serves as a primary key — that is, a field that contains only unique values and no blanks.

Excel Power Pivot & Power Query For Dummies

Подняться наверх