DEV Community

ClintWithK
ClintWithK

Posted on

Introduction To Schemas & Data Modeling In Power BI

Power BI being a Microsoft's business analytics platform that helps to turn data into actionable insights. Whether it's a business user, report creator, or developer, Power BI offers integrated tools and services to connect, visualize, and share data across your organization. In this article we are going to take a deeper dive into understanding what are schemas and Data Modeling in Power BI.

Firstly let's jump right into understanding What is a Schema? and What is Data Modeling?

While trying to understand these vital aspects in Data field, we are going to come across key words like: Fact tables, Dimensional tables, Relationships, one to many, filter propagational arrows, performance and usability. We are also going to explore all these key words with demonstrations using sample dataset that can be downloaded using link: [(https://chandoo.org/wp/wp-content/uploads/2024/10/sample-chocolate-sales-data-all.xlsx)]

Load data into Power BI as shown in the image below:

Select Excel Workbook, which will trigger files window on your screen:
An Image showing Power BI page where you select your data source

Select the correct excel workbook

Image showing selecting excel file from file system of windows machine

Select the worksheets & Load the data

An image showing an interface for selecting worksheets and loading it to power BI

Now you have loaded data successfully into Power BI, let's now explore Schemas and Data Modeling using the loaded data.
Before jumping into Schemas, let's understand what is Data Modeling. Having this understanding will help us have a clearer catch of the Schema concept.

Data Modeling

Data modeling is the process of structuring and organizing data to define how it is stored, related, and used within a system. In Power BI, it involves creating a logical data model by connecting tables, defining relationships, setting data types, and building calculations (e.g., using DAX) to support accurate and efficient reporting.

Purpose:

  • Enable meaningful analysis by linking fact tables (quantitative data) with dimension tables (descriptive context).
  • Support fast query performance and intuitive report design.
  • Ensure data integrity and reduce redundancy.

Key Components:

  • Tables: Fact tables (e.g., shipments) and dimension tables (e.g., product, calendar, people, location).

Fact Tables: usually have large data depending on the size of the firm, can be upto billions or even trillions of rows and, narrow columns(few Attributes).

Dimension Tables: These are the owner of the information in a dataset hence having few rows and fat columns(Many Attributes), this is usually relative depending o the size of the orgaization.
An illustrations as shown below:

An Image showing examples of fact and dimension tables

  • Relationships: Typically one-to-many (1:M), defining how tables are connected (e.g., via PID, SPID, cal_date). This illustrated in the image below:

Understanding Relationships

Key reasons for accurate relationships:

  • Data Accuracy: Ensures that aggregations (e.g., total sales) are calculated correctly across related tables.
  • Filter Propagation: Enables interactive filtering—when a user selects a value in one visual, related visuals update accordingly based on the defined cross-filter direction.
  • Performance Optimization: One-to-many relationships with single-direction filtering improve query speed and reduce ambiguity. Avoiding unnecessary bi-directional filters prevents performance degradation.
  • Avoiding Ambiguity: Multiple relationships between the same tables can cause errors. Using inactive relationships with USERELATIONSHIP() in DAX resolves ambiguity and allows precise control over which relationship is used in calculations.
  • Model Integrity: Prevents issues like circular references, incorrect data types (e.g., DateTime vs. Date), and data integrity problems that arise from mismatched or poorly defined links.

Best Practices:

  • Always verify Power BI’s auto-detected relationships they are not always accurate.
  • Use one-to-many relationships as the default; avoid one-to-one unless necessary.
  • Set cross-filter direction to Single unless a specific use case requires Both.
  • Use bridge tables for many-to-many relationships to maintain model clarity and performance.
  • Regularly manage and edit relationships via the Manage Relationships dialog to ensure alignment with business logic.

manage relatioships

  • Schema Types: Star schema (recommended), snowflake, or flat models. A well-designed data model is foundational for scalable, high-performance Power BI reports

Schemas

What is a Schema? A schema is the logical structure or blueprint of a database that defines how data is organized, stored, and related. It includes tables, columns, data types, relationships, constraints, and other elements, but does not contain the actual data.
In Power BI, a schema refers to the data model's structure, showing how tables are connected to support efficient querying and reporting.

Common schema types in Power BI include:

  • Star Schema: One central fact table linked to multiple dimension tables (recommended for performance). As illustrated in the image below:

An Image showing Star Schema

  • Snowflake Schema: A normalized version of the star schema, where dimension tables are further split. Also sometimes considered as a variant of a Star schema with more things hanging off at the end.

An Image illustrating Snoflake Schema

Conclusion.

Proper schema design and data modeling are essential for building accurate and efficient Power BI reports. Using well-structured schemas, such as the star schema, and defining correct relationships ensures reliable calculations, optimal performance, and simpler DAX expressions. A strong data model enables clear insights, supports scalability, and allows decision-makers to trust the results produced in Power BI.

Top comments (0)