Data modeling is the process of organizing your data into tables, defining relationships between them, and enhancing the data with calculated fields, measures, and hierarchies.
In Power BI, data modeling is crucial because it helps Power BI understand how different tables relate to one another.
For example, in a business scenario, we often have different data sources: maybe one for Sales, another for Customers, and a third for Products. Data modeling allows us to create a structure where all of these tables can work together to provide insights.
Without a proper data model, Power BI would struggle to combine the data correctly and give you accurate reports.
Data Modeling in Power BI: Key Components
1- Tables
Tables hold your data. In Power BI, you can import tables from various sources like Excel, SQL Server, or cloud services. Each table can have multiple columns representing different fields. For example, you might have a Customers table with columns for Customer Name, Customer ID, Country, and so on.

2- Primary and Foreign Keys
When creating relationships, one table should have a primary key (a unique identifier, such as Customer ID or Product ID) that uniquely identifies each row. The other table has a foreign key, which refers to the primary key in the first table.

3- Relationships
Relationships are at the core of data modeling. In Power BI, you define relationships between tables so that data can be combined. These relationships are typically based on common columns (like Product ID in both the Sales table and Product table).
Here’s an example: You have two tables, one for Sales Transactions and another for Products. You can create a relationship between the two tables using the Product ID column, linking sales data to product details.
Active/Inactive Relationship
An active relationship is the default relationship that Power BI uses to filter data between two tables. When you create a relationship between two tables, it is typically set as active.
An inactive relationship is a relationship that exists but is not currently being used to filter data.
Inactive relationships can be activated using DAX functions such as USERELATIONSHIP

4- Cardinality
In Power BI, cardinality refers to the type of relationship between two tables based on the uniqueness of values in the columns that are related.
It defines how data from one table corresponds to data in another table. Cardinality is crucial for creating proper relationships between tables in a data model, which is fundamental for accurate data analysis and reporting.
Types of Cardinality in Power BI
There are four main types of cardinality in Power BI:
1-One-to-Many (1:*M): This is the most common type of cardinality in Power BI. It means that one value in a column of one table corresponds to many values in a related table. For example, one Customer can have multiple SalesTransactions.
2-Many-to-One (M:1): Essentially the reverse of One-to-Many, it represents the same relationship but from the perspective of the other table. Power BI automatically treats this as the same as One-to-Many.
Example:
- One table: Customers
- Many tables: SalesTransactions
- Relationship: One customer can place many orders, but each order is linked to only one customer.
3-One-to-One (1:1): In this type of relationship, one value in a table corresponds to one and only one value in the related table.
This is less common and used when each record in one table matches exactly one record in another.

4-Many-to-Many (M): In this type of relationship, multiple rows in one table can be related to multiple rows in another table. In Power BI, Many-to-Many relationships were introduced to handle scenarios where both tables contain duplicate values.

5- Cross Filter Direction
When creating relationships between tables, Power BI allows you to choose the direction in which filters can flow. This setting is crucial for determining how data is filtered across related tables in your reports.
There are two primary types of cross-filter directions in Power BI:
1- Single Direction (One-way) Cross Filter: In single-direction cross filtering, filters applied to one table affect the related table in one direction only.
Typically, filters flow from the one (dimension) table to the many (fact) table. This is the default and most common setting for relationships in Power BI.
Example:
Imagine two tables: Customers (dimension table) and SalesTransactions (fact table). The relationship is a One-to-Many relationship, where:
- Customers table has unique CustomerIDs.
- SalesTransactions table has multiple records for each CustomerID.
In a single-direction filter:
- Filtering the Customers table filters the SalesTransactions table.
- However, filtering the SalesTransactions table will not filter the Customers table.
Use Case:
This type of filter is used when you want to analyze facts (like sales transactions) based on dimensions (like customers or products). For example, if you select a customer from a filter or slicer, it will only show transactions related to that customer in the SalesTransactions table.
2- Both Directions (Bi-directional) Cross Filter: In bi-directional cross filtering, filters can flow in both directions between two related tables. This means that filters applied to either table in the relationship will affect the other table. Bi-directional filtering is typically used in more complex models, especially in situations involving multiple fact tables or in scenarios with multiple relationships between tables.
Example:
Using the same example of Customers and SalesTransactions:
- If you filter the Customers table, it will filter the SalesTransactions table.
- If you filter the SalesTransactions table (e.g., filtering sales records for a specific product), it will filter the Customers table to show only the customers associated with those sales.
Use Case:
BI-directional filtering is particularly useful in Many-to-Many relationships or when dealing with multiple fact tables. It allows more flexibility in slicing and dicing data across multiple tables.

6- Hierarchies in Data Modeling
In Power BI, hierarchies are a way to organize data into a structured format that allows users to drill down or roll up through different levels of data. Hierarchies enable better data analysis and visualization, particularly when dealing with categorical data that can be logically grouped.
Examples of Hierarchies:
Date Hierarchy: In DateTable, you could define a date hierarchy that consists of levels like Year, Quarter, Month, and Day. This allows users to analyze data at different time levels and easily drill down or roll up data.
Example:
Year → Quarter → Month → Day
Product Hierarchy: In the Products table, a product hierarchy could represent different levels of product categorization, such as Category, Subcategory, and Product.
Example:
Category → Product

7- Calculated Columns and Measures
Calculated Columns: It is a new column that you create using a DAX (Data Analysis Expressions) formula, and it is added to an existing table in your data model. For example, creating a new column in Date Table for Year and Month together.
Year Month = Format(DateTable[Date], "YYYY-MM")
Measures: Measures are similar to calculated columns, but they perform dynamic calculations based on the user’s interactions with the report. For example, calculating
Total Sales = SUM(SalesTransactions[TotalAmount])
8- Star Schema in Data Modeling
The star schema is one of the simplest and most commonly recommended approaches for organizing a data model in Power BI.
It consists of a fact table at the center, which is surrounded by several dimension tables. These tables are directly related to the fact table, forming a star-like pattern.
Components of a Star Scheme:
Fact Table:
- This table stores transactional or event data, such as sales, orders, or payments. It generally includes measures like SalesAmount, Quantity, and other numeric values that you want to analyze.
In our example: SalesTransactions is the fact table, containing data such as TransactionID, CustomerID, ProductID, TransactionDate, Quantity, and SaleAmount.
Dimension Tables:
- These tables store descriptive information that provides context for the data in the fact table.
- Dimension tables usually have a primary key that uniquely identifies each record.
- Dimension tables typically contain non-numeric data, such as names, categories, or dates.
Example:
Customers: Contains information about customers, such as CustomerID, Name, Country, etc.
Products: Contains details about products like ProductID, ProductName, Category, etc.
DateTable: Stores dates and related information like Year, Month, Quarter, etc.

I hope you enjoyed the post. Your valuable feedback, questions, or comments about this post are always welcome.
![]()

fantastic raturi brother
wish you a happy Diwali to you and your family!!!!
Thanks Siri, Happy Diwali 🪔