Data Modeling in DAX

Data Modeling in DAX

Everything You Need to Know with Real-World Examples


Data modeling is a crucial component in DAX (Data Analysis Expressions), which is the formula language used in Power BI, Excel, and other Microsoft data analysis tools. A well-designed data model enables analysts to analyze and visualize vast amounts of data and provides insights into complex business questions. In this blog post, we will take you through the fundamental concepts of data modeling in DAX with examples.

Tables and Relationships

In DAX, data models comprise one or more tables that are connected to each other. Tables contain columns that represent distinct data fields. Relationships between tables are established using keys that consist of unique values.

For example, consider a scenario where you have two tables - a Customers table and a Sales table. The Customers table has a column named CustomerID, which is the unique identifier of each customer. The Sales table also has a column named CustomerID, which links to the CustomerID column in the Customers table. This establishes a relationship between the two tables.


Cardinality refers to the number of unique values in a column. In DAX, there are three types of cardinality: one, many, and blank. One cardinality means that there is a one-to-one relationship between the two tables. Many cardinality means that there is a one-to-many relationship between the two tables. Blank cardinality means that there is no relationship between the two tables.

For instance, let's consider the scenario mentioned above, where the Customers table and the Sales table have a relationship established by the CustomerID column. In this case, the cardinality is many-to-one, as multiple sales transactions can be associated with a single customer.


Cross-filtering allows you to filter data in one table based on data in another table. In DAX, there are two types of cross-filtering: single-directional and bi-directional. Single-directional cross-filtering filters data in one table based on data in another table, while bi-directional cross-filtering filters data in both directions.

Suppose you have a third table named Products, which has a column named ProductID. You can establish a relationship between the Products table and the Sales table by creating a column named ProductID in the Sales table that links to the ProductID column in the Products table. Now, you can use cross-filtering to filter data in the Products table based on data in the Sales table.

Calculated Columns

Calculated columns are columns created using DAX formulas. They can be used to add new columns to a table or to perform calculations on existing columns. Calculated columns are useful for creating new categories or aggregating data.

For example, suppose you have a Sales table that contains a column named Quantity and a column named Price. You can create a calculated column named Total Sales, which multiplies the Quantity and Price columns to give you the total sales value.


Measures are calculations based on the data in a table. They can be used to perform calculations such as summing or averaging data, or to calculate ratios or percentages. Measures are calculated on the fly, which means they are only calculated when they are needed.

Suppose you have a Sales table that contains a column named SalesAmount. You can create a measure named Total Sales that sums up the values in the SalesAmount column. This measure can be used to calculate the total sales value for a given period or customer.

Designing for Performance

When designing a data model in DAX, it is important to consider performance. The performance of a data model can be affected by the number of tables, the size of the tables, the complexity of the relationships, and the number of calculations. It is important to optimize your data model for performance by minimizing the number of tables and columns, using appropriate data types, and avoiding complex relationships.


Data modeling is a critical skill for analyzing and visualizing data in DAX. In this blog post, we covered the fundamental concepts of data modeling, including tables and relationships, cardinality, cross-filtering, calculated columns, measures, and performance optimization. We hope this guide has provided you with a solid foundation to start building your own data models in DAX.

If you have liked this post, you may also my other blog posts.

  1. Mastering DAX Basics: Learn the fundamentals of DAX syntax and functions with practical examples

  2. Understanding Calculated Columns and Measures in DAX

  3. Mastering DAX Context: Understanding Row, Filter, and Evaluation Context

Did you find this article valuable?

Support Rajanand Ilangovan by becoming a sponsor. Any amount is appreciated!