Editing relationships
Now, let's take a look at how to edit an existing relationship. In this example, you will edit the relationship between FactInternetSales and DimCustomer. To edit an existing relationship, select that relationship and then click on Edit.... See Figure 5, here:
Once you select Edit... you will receive a new dialog box; this is the Edit Relationship editor. In this view, you will see how to change an existing relationship, how to change a relationship to active or inactive, and the cardinality of the current relationship; this is also where you can change the cross filter direction:
There are five things we want to look at in the edit relationship window:
- This identifies the FactInternetSales table and the column that the relationship was built on.
- This identifies the DimCustomer table and the column that the relationship was built on.
- This checkbox identifies whether the relationship is active or inactive.
- This is the current cardinality between the two tables. Here we see that there is a many-to-one relationship between FactInternetSales and DimCustomer. Power BI does an excellent job of identifying the correct cardinality, but it is important to always verify that the cardinality is correct.
- The cross filter direction can be single or both. The one side of a relationship always filters the many side of the relationship, and this is the default behavior in Power BI. The cross filter option allows you to change this behavior. Cross filtering will be discussed later in this chapter.
If you need to change the relationship of an existing relationship, then you would do that in the edit relationship editor seen in Figure 6. To change the column that a relationship has been created on, simply select a different column. It is important to point out that a relationship between two tables may only be created on a single column. Therefore, if you have a multiple column key, also known as a composite key, then you would need to first combine those keys into a single column before creating your relationship. You saw how to combine columns in the previous chapter.