An Introduction To Data Models in Power BI (Slides)
An Introduction To Data Models in Power BI (Slides)
| A data model is a conceptual representation of data and its structure within a database.
Data models in SQL and in Power BI serve different purposes but are closely related when it comes to business
intelligence and data analysis.
Data models, such as entity-relationship data models, are Data models help us build analytical models that enhance
primarily used for database management and data our analytical capabilities by providing relationships
storage. between data tables.
They define how data are structured, stored, and This enables us to aggregate and filter across and analyse
organised within relational database systems. from multiple sources.
2
Data models in Power BI
| Since SQL and Power BI data models are related, we can apply our knowledge of data models in
SQL to Power BI, and also use them together.
|
A good data model in Power BI is essential for ensuring that our reports and dashboards provide
valuable insights and are efficient to work with. Some of the key characteristics of a good data model
include:
Users should be able to quickly navigate through data, filter, and drill down to
Efficient data
gain insights without experiencing significant delays or performance issues.
exploration This requires optimising the model for responsiveness.
Accuracy is paramount in any data model. It should reflect the true state of the
Data
underlying data, and transformations and calculations should be carried out
accuracy accurately. Inaccuracies can lead to incorrect insights and decisions.
4
Data models in Power BI
Business requirements change over time. A good data model should be flexible
Flexibility enough to adapt to evolving needs. This might involve modifying relationships
or adding new data sources, while maintaining data integrity.
It’s important to note that not all “good” data models will always fit our requirements, i.e. it isn’t always
one-size-fits-all. Therefore, it’s important to know the characteristics of a good data model because, chances are,
we’ll have to experiment until we find the right balance.
5
Data models in Power BI
| As in SQL, a variety of data models can be implemented in Power BI. However, the most
commonly used data modelling approach in Power BI is the star schema.
6
Data models in Power BI
Country
Dimension table
Country_ID (PK)
Fact table
Indicator
Country_name
Gender_inequality
Indicator_ID (PK)
Region
Country_ID (FK)
Indicator_description
Development
Year
Indicator_group
Indicator_ID (FK) Each row in the fact table represents a
specific event or transaction, and it
Indicator_value
includes foreign keys that link to
dimension tables.
A single table at the centre of the schema
that contains quantitative measures or
facts, such as Indicator_value.
7
Data models in Power BI
Country
Dimension table
Country_ID (PK)
Fact table
Indicator
Country_name
Gender_inequality
Indicator_ID (PK)
Region
Country_ID (FK)
Indicator_description
Development
Year
Indicator_group
Indicator_ID (FK)
Indicator_value
Often contains attributes and
Generally, they help answer hierarchies related to its
questions like “who”, “what”, dimension, for example,
“where”, “when”, and “how” Provides the context and Country_name and Region.
regarding the measures in the descriptive attributes for
fact table. the data in the fact table.
8
Data models in Power BI
Dimension table
Country_ID (PK)
Fact table
Indicator
Country_name
Gender_inequality
Indicator_ID (PK)
Region
Country_ID (FK)
Indicator_description
Development
Year
Indicator_group
Indicator_ID (FK)
Indicator_value
Each row in the fact table represents a
specific combination of measures or facts,
for example, Country, Year, and
Indicator_ID, which implies that multiple
indicator values can be associated with a
single country.
9
Data models in Power BI
| A good and simple table structure allows us to organise the tables in the data model in a way
that makes it easy to navigate, work with, and create meaningful reports and visualisations.
Each table should have a clear and specific purpose, Tables should have well-defined and appropriately named
representing a distinct entity or dimensions. For example, columns. Column names should be descriptive and
having distinct dimension tables such as Indicator and unambiguous, such as Indicator_description and
Country. Country_name.
10
Data models in Power BI
In some cases, data from multiple sources will have to be Establishing appropriate relationships between tables is
merged (combined) or appended (stacked) to tables in crucial for data analysis. They define how tables are
the data model in order to reduce complexity and connected and how data can be combined and analysed
redundancy. across different dimensions.
We can append tables when we want to stack similar data Appropriate relationships include using unique values for
structures on top of each other. For example, having the primary and foreign keys and considering the cardinality
Indicator_value for all Year instances in the fact table, (such as one-to-one and one-to-many) of relationships and
rather than having distinct tables for each year and the the directions (both or single direction) of these
related indicator values. relationships.
11
Data models in Power BI
| Data granularity refers to the level of detail or specificity at which data are recorded and stored
in a dataset or database. It defines how fine-grained or coarse-grained data observations are.
Allows for more precise and detailed analysis. Provides a more summarised view of the data.
The data is more complex which may require more A more user-friendly data model as the number of
effort to design and maintain the data model. tables and relationships to manage is reduced.
More resource-intensive to store and process data Requires less storage and may result in faster query
which may result in slower query performance. performance.
12
Data models in Power BI
13