DEV Community

Justine Kimeli
Justine Kimeli

Posted on

Understanding Relationship, Schemas and Joins In Power BI

Introduction

Power BI is a powerful business analytics and visualisation platform used to connect, transform and analyze raw data from various sources. This platform helps organizations to generate reports and dashboards that helps them make better and reliable decisions.
In this article, we are going to learn what are relationship,schemas and joins and how they play a role in performing power querry in Power BI.

Relationship in Power BI

In basic terms, relationships means a link between two things. In Power BI, relationship shows how rows in one table are connected to other rows in another table based on a unique key.

Types of Relationship

There are 4 types of relationship which includes; one-to-one, one-to-many, many-to-one and many-to-many. This relationship helps in combining information in multiple columns without duplicating it.

One-to-One Relationship

This relationship means each row in one table corresponds to exactly one row in another table. A perfect example is a student having one id to access a student portal account.

One-to-Many Relationship

This type of relationship that is commonly used in relational databases and in Power BI.It means that one record in a parent table can be associated with many records in a child table, but each record in the child table can be associated with only one record in the parent table.
An example is one student can register for many courses.

Many-to-One Relationship

This is basically the reverse of one-to-many type of relationship. An example is that many patients seeks medication from one doctor.

Many-to-Many Relationship

This type of relationship means multiple records in both tables share the same values.For example students enroll in multiple courses and each course has may students.

Schemas

A schema is basically how data is defined or structered in a database. It defines how data is organized including tables, columns, keys,data types and relationship between the tables.

Star Schema

A star schema is data modelling technique that is used to warehouse data. It organizes data into a central fact tables with different dimension tables forming a shape that is like a star.
In start schema, fact table stores numerical values and foreign keys that directly links the dimension table while dimension table provides descreptive context behind the numerical values in the fact table.

Snowflake Schema

This is a database design where dimension tables are normalized into multiple related sub-tables to reduce duplicate data.

Joins In Power BI

A join is a connection between two tables using a common column so that related data can be combined together. Joins are done in power querry editor.

Power BI jons

Inner join: It returns matchinhg rows only.
Left outer join: It returns all rows fro the first table and matching rows from the second table.
Right outer join: It returns all rows from the second table and matching rows from the first table.
Full outer join: It returns all rows from both tables.
Left anti join:It returns rows from the table with no match in the second table.
Right anti join: It returns rows from the second table with no match in the first table.

Conclusion

Finally, understanding relationships, schemas, and joins is important for building effective data models in Power BI. Relationships enable tables to work together, while schemas provide a structured framework for organizing data. Joins make it possible to combine data from different sources into a single, meaningful dataset. Mastering relationships, schemas, and joins is therefore a key skill for developing efficient Power BI reports, dashboards and making better insightful decisions.

Top comments (0)