Model data in Power BI
Introduction
Microsoft Power BI is a collection of apps, software services and connectors that come together to turn unrelated data into visually impressive and interactive insights. Power BI can work with simple data sources like Microsoft Excel and complicated ones like cloud-based or on-premises hybrid Data warehouses. Power BI has the capabilities to easily connect to your data sources, visualise and share and publish your findings with anyone and everyone.
Power BI is simple and fast enough to connect to an Excel workbook or a local database. It can also be robust and enterprise-grade, ready for extensive modeling and real time analytics. This means it can be used in a variety of environments from a personal report and visualisation tool to the analytics and decision engine behind group projects, divisions, or entire corporations.
As Power BI is a Microsoft product and has built in connections to Excel, there are many functions that will be familiar to an Excel user.
Power BI is one of the leading data visualisation tools on the market. This current article is part of the Power BI like a Pro series written by TrueCue’s most experienced Power BI developers.
A data model can be defined as the organisation and relationships of a set of two or more data tables.
There are several ways to represent data models, one of the most commonly used method is the Entity-Relationship Diagram (ERD).
Power BI’s data model view represents the report’s data model with an ERD:
In Power BI, developers can access the “Data Model” view by clicking on this icon on the left pane of the Power BI Desktop interface:
Data models are central to relational databases and data warehouses. They describe how different tables are linked to one another. The goal of the data modelling process is to design the optimal data architecture/relationships for a specific purpose. It is important to note that even if there exist data model best practices, the one-size-fits-all data model is still to be discovered.
As its name indicates, traditional entity-relationship models are composed of two key elements:
1. Data Tables (“entities”)
A data table can be conceptualised as a way to store information in a tabular format, with rows and columns (see the diagram below):
Each row is a particular instance, observation, or entity-type. Each column is an attribute. A single row of data has several attributes. As an example, the row highlighted in the example table above is a meteorological observation of the 23/08/2020. This observation has several attributes (“columns”), including temperature, humidity and precipitations.
2. Data Relationships (“relationships”)
A data relationship is the way in which different data tables are linked together. In other word, it describes the way in which the information stored in one table relates to the information stored in another. The following simple example will illustrate the concept of data relationships:
Let’s consider two tables:
Fact_Sales: recording daily sales volume for each product
Dim_Product: storing product information such as name and description
These two tables are linked by “Product ID”. In practice, this means that the product information can be accessed from sales through the “Product ID” attribute. In other words, retrieving the product names that have sold the greatest quantity will require a search through Product IDs in the Fact_Sales table, and a join with Dim_Product to retrieve the product names of the highest selling Product IDs.
The relationship key is the field used to travel from one table to the next, i.e. to link information stored in two different tables.
This relationship between Fact_Sales and Dim_Product has a many-to-one cardinality. This means that each row into the Product Information table (Dim_Product) links to several rows in the Product Sales table (Fact_Sales). In other word, a single product ID, is featured several times in the Sales Table, and only once in the Product Information table.
A data relationship’s cardinality describes the numerical relationship between rows of one table and the rows of the other. The main cardinalities include:
one-to-one: one-to-one cardinality indicates that each row of a table maps to a single row of another table
one-to-many (or “many-to-one”): one-to-many relationships are very frequent in traditional star-schemas. One-to-many relationships occur when a single row of a table maps to more than one row in another table. This is the case of the example relationship studied above
many-to-many: many-to-many relationships are very tricky to deal with. They occur when multiple rows in one table link to multiple rows in another.
Comments
Post a Comment