DEV Community

Cover image for Power BI Data Modeling.
Joseous Ng'ash
Joseous Ng'ash

Posted on

Power BI Data Modeling.

What is Data Modeling in Power BI

In simple and understandable terms, Data Modeling is simply a way to organize, connect and structure your data in a way it can be easily analyzed and visualized.

  • Raw data = Messy datasets
  • Data modeling = organize and arrange the dataset into meaningful structure

Data Modeling in Power BI: Creating relationships between tables and structuring data into a format that enables accurate analysis and reporting.

Data Modeling Involves

  • Creating relationship
  • Defining structure(Schema)
  • Organizing Data into tables
  • Setting rules(Cardinality & Filters)

Data modeling is important because;

  • We can derive accurate analysis
  • We can get better insights
  • Can create clear and accurate dashboards

Power BI uses some of components to help in data modeling

Main Components of Data Modeling in Power BI.

Joins In Power BI
Joins are used when combining tables into one (This is usually done in Power Query Editor).

Types Of Joins In Power BI

Inner Join: It only returns matching rows in both tables and it is used when you only want related data. How Inner join looks like. inner outer join

Left Outer Join: This is the most commonly used join. It returns all rows from the left table plus matching rows from the right.left outer join

Right Outer Join: This join act opposite of the Left Outer Join. It returns all rows from the right table plus matching rows from the left table. right outer join

Full Outer Join: This type of join in power bi, returns all the rows from both table, matched or unmatched. full outer join

Anti Join(Left/Right): This type of joins are used to return the unmatched rows, usually help in finding missing data.anti join

Relationships In Power BI
In Relationship tables are connected without merging them. Instead of combining data physically, Power BI links tables logically.

Key Concept

  • Primary Key → Unique column (e.g., ProductID in Products)
  • Foreign Key → Repeated column (e.g., ProductID in Sales)

Cardinality: defines how table relate, example;

  • One-to-many(1:):* commonly used relationship, meaning one product many sales. One-to-many(1:*)
  • Many-to-one(:1):* it is the same as one-to-many but reversed.
    Many-to-one

  • One-to-one(1:1): this relationship is rarely used during data modeling.
    One-to-one(1:1)

  • Many-to-many(:): this type of relationship create ambiguity and should be used carefully.
    Many-to-many(:)

Cross Filter Direction

  • Single direction: the filter flow from one direction and its the recommended filter.
    Single direction

  • Both Direction: the filter flows both ways though it can cause confusion if misused. Both Direction

Schemas (Data Modeling Structures)
Schemas define how your tables are organized.
Star Schema (best practice)
This is the recommended approach in Power BI. Schemas (Data Modeling Structures)

Structure
Fact Table: contains measurable data eg sales, revenue, quantity.
Dimension Tables Eg customers, dates, products

Benefits of star schema includes;

  • It is easy to understand
  • Better performance in Power BI
  • It is easy and fast

Snowflake Schema
This is a more complex version of star schema

Structure
In this type of schema, dimension tables are split into Sub-Tables though it is slow in performance and harder to manage.
Snowflake Schema

Flat Table (Single Table)
This type, the data is in one table and has poor performance, hard to manage and also data redundancy.
Flat Table

Conclusion

Data modeling in Power BI is the process of organizing data into structured tables and creating relationships between them to enable accurate analysis and reporting. It involves arranging data in an efficient format, such as a star schema, to improve performance and ensure that filters and calculations work correctly. Overall, good data modeling helps transform raw data into meaningful insights for better decision-making.

Top comments (0)