PowerBI basic knowledge-data modeling

SQL column

Summary of basic knowledge of SQL database

Summary of advanced knowledge of SQL database

Data modeling

Data modeling is a function listed separately in PowerBI, which can be understood as dealing with relationships between tables. The relationship between common tables is one-to-one, one-to-many and many-to-one.

Example

Let's take the following three tables Customer1, Customer2 and Customer table as examples

PowerBI basic knowledge-data modeling

When the tables imported into PowerBI have inherent connections, PowerBI will automatically establish the connections between the tables, as shown below:

PowerBI basic knowledge-data modeling

We see that Customers1 and Customers2 have established a one-to-one relationship through customer ID.

Let's talk about the difference between each relationship

One-to-one: It means that there is a one-to-one correspondence between the fields of the associated tables, and each table has and can only find one associated field in the other table.

One-to-many: It means that one associated field record in table A can find multiple matching associated fields in table B. Generally speaking, there is one record in A and multiple identical records in B

Many-to-one: In contrast to one-to-many, multiple associated field records in table A correspond to one record in table B.

Establish relationship

In addition to automatically establishing the association relationship in PowerBI, we can also create it manually.

The customer in the customer information in the above picture can actually be associated with the customer name in Customers1, but because the field names in the two tables are different, PowerBI cannot detect it, so we can manually associate them. As shown below:

PowerBI basic knowledge-data modeling

You can directly connect the two fields that have an association relationship with the mouse. From the figure, we can see that the relationship between Customers1 and customer information is a many-to-one relationship.

Edit relationship

Double-click the connection line of the association relationship, and the editing window will pop up, as shown in the figure below:

PowerBI basic knowledge-data modeling

Delete relationship

When we do not need the association relationship, directly select the connection line, right-click to delete or press the DELETE key on the keyboard to delete.

The role of linked data

After establishing the association relationship, we can query the data in another table through the association relationship between the tables, making it look like operating in a table.

annotation

Data modeling is actually to find the inner connection between the tables, so that they can be connected to better perform data operations. And the operation is also very simple, just find the correlation between the different tables, and you can complete it by dragging and dropping it directly.

Guess you like

Origin blog.51cto.com/15057820/2655147