Skill 2.1: Design a data model
A proper data model is the foundation of meaningful analysis. A Power BI data model is a collection of one or more tables and, optionally, relationships. A well-designed data model enables business users to understand and explore their data and derive insights from it. This step should be taken before you create any visuals by loading your data and defining the relationships between tables. Data modeling often occurs at the beginning phase of building a Power BI report so that you can create efficient measures that build upon your data model. In this section, we design a data model by focusing our attention on tables and their relationships.
This skill covers how to:
- Define the tables and design a data model that uses a star schema
- Configure table and column properties
- Design and implement role-playing dimensions
- Define a relationship’s cardinality and cross-filter direction
- Create a common date table
Define the tables and design a data model that uses a star schema
Once a query is loaded, it becomes a table in a Power BI data model. Tables can then be organized into different data model types, also known as schemas. The three most common schemas in Power BI are:
- Flat (fully denormalized) schema
- Star schema
- Snowflake schema
There are other types of data models, though these three are the most common ones.
Flat schema
In the flat type of data model, all attributes are fully denormalized into a single table. Because there’s only one table, there are no relationships, and in most cases there’s no need for key.
In our Wide World Importers example, we have a single table that contains all columns from all tables, meaning that the Sale and Targets columns will be in the same table. Because the tables have different data granularity, you run into problems when comparing actuals and targets.
Note Data Granularity
We review the concept of data granularity later in this skill section.
From the performance point of view, flat schemas are very efficient, though there are downsides:
- A single table can be cumbersome and confusing to navigate.
- Columns and data can often be duplicated, leading to a comparatively large file size.
- Mixing facts of different grains results in more complex DAX formulas.
Flat schemas are often used when connecting to a single, simple source. However, for more complex data models, flat schemas should be avoided in Power BI as much as possible.