Lecture-5-Exploring Data Visualization in Power BI

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 45

Stacked Bar Chart:

Note total legend has to be enabled from properties.

Stacked column chart:


Cluster Bar Chart: Better for comparison:
Cluster Column Chart:
Table: the numerical alternative of clustered charts:
Matrix:

In Power BI, a table visual presents data in a spreadsheet-like format with rows and columns, suitable for displaying detailed records
and supporting sorting, filtering, and formatting options. On the other hand, a matrix visual offers a hierarchical representation of
data, allowing for aggregation across multiple dimensions and interactive features like drill-down capabilities, making it ideal for
summarizing and comparing data. The choice between using a table or matrix visual depends on the level of detail and interactivity
required for presenting the data effectively to users.

Matrix is like pivot table but there is no pivot table in PBI. In Power BI, the Matrix visual is integrated within the reporting canvas,
providing seamless integration with other visuals and dashboard elements. Excel pivot tables are standalone objects within a
spreadsheet.
We can also decompose row wise:
100 stacked column chart:
Line chart:
Area chart:
Line and stacked column chart:

In this chart there can be two different y-axes for a particular x-axis. One for stacked column chart and another for line chart like here
in a department(x-axis) we are showing take home salary of each department(stack y-axis) and head count for that department(line y-
axis).
We can also link a slicer with a chart to further filtering of the data:
Line with column chart: like here we are showing for a particular department(x-axis) the sales (column y-axis) and the revenue (line y-
axis):
Waterfall chart: suitable for like cash flow statements, sales up/down. It’s suitable for financial statements data:

A waterfall chart shows a running total as values are added or subtracted. It's useful for understanding how an initial value (for
example, net income) is affected by a series of positive and negative values. The columns are color coded so you can quickly tell
positive from negative numbers.
Funnel chart:

A funnel chart is a unique type of data visualization that provides a visual representation of data
as it progresses through different stages of a process. This unique chart derives its name from its
shape, which resembles a funnel with sequentially narrowing sections.
Scatter plot:

Pie chart:
Doughnut chart:
Treemap:
Map: (See about it in excel tutorial)

Filled Map:

The difference between a map and a filled map is that a map only shows the data points for the selected location, but
a filled map selects the area portion of that location on the map. The location can be state, country, city, pin code, etc.
We have various options to format maps.
KPI Visual: Guage (an instrument or device for measuring the magnitude, amount, or contents of something)
Following tools will be covered later on like python and R script visuals:

Python visual:

.
Relationship between two sheets in data model view:

Consider the budget data sheet. Now if we don’t create a relationship between these two sheets then this will happen:

But if we make a relationship between tables:


And if values in date columns of both tables are entered in the same way as it is not the case in our sample file. Date columns were
entered differently in both tables like this:

Then result won’t be shown correctly in report view:

But if we follow same way like this:

Then result would be perfect:


Another better approach is to make a separate table of dates ‘calendar’ that includes all the dates between the specified period(in our
case it is the 2012-2013) as it is best practice in PBI to make a separate table for all the dates for many reasons like date shouldn’t be
kept as primary key of a table because dates in some records dates are usually missing but as we know primary key columns must not
be left blank. So, this will create problems.

So, in PBI for making a separate table for all possible dates, we will follow these steps:

We can generate a new table in PBI using new query in Transform tab:

Now you can type a new query or you can copy-paste a query using ‘M’ language of PBI.

Right now, we are using following query (we are not going in the details of the syntax of this query. Just know that it will create a
table of all possible dates i.e. calendar. Note that this table won’t include specific date columns of budget and payroll tables. It is just a
“general” table of all possible dates between the specified period (to be taken as parameters of this query)
Click done after typing / pasting the query:
This is a parameterized query that will ask some parameters from the user and then create and fill the table accordingly.

It will ask following parameter on clicking the done button:


Click on invoke:
Click close and apply and go to model view in PBI Desktop window.
Procedure to edit a one-to-one relationship into one to many (Suppose we are doing this to Budget and Calendar relationship which
is basically a one-to-one relationship):
What is cross filter direction in PBI?

In Power BI, the "Cross filter direction" in the relationship window defines how filters flow between related tables in a data model.
This feature determines whether filters applied on one side of the relationship propagate to the other side and vice versa.

There are three types of cross-filter directions in Power BI:

1. Single Direction (Default):


 Filters applied on the primary (or 'One') side of the relationship flow to the related (or 'Many') side, but not vice versa.

 This is the default behavior when you create a relationship in Power BI unless specified otherwise.

 It's represented by a single arrow pointing from the primary to the related table in the relationship diagram.

2. Both Direction:

 Filters applied on either side of the relationship propagate to the other side.

 This means that filters applied on the 'One' side will affect the 'Many' side, and filters applied on the 'Many' side will
affect the 'One' side.

 It's represented by double arrows indicating bidirectional flow between the tables in the relationship diagram.

3. Single Direction (Reverse):

 Filters applied on the related (or 'Many') side of the relationship flow to the primary (or 'One') side, but not vice versa.

 This is less common but can be useful in certain scenarios.

 It's represented by a single arrow pointing from the related to the primary table in the relationship diagram.

Let's illustrate these concepts with an example:

Suppose we have two tables in our Power BI data model: 'Sales' and 'Products'. The 'Sales' table contains information about sales
transactions, including the product sold, and the 'Products' table contains details about each product.

 If we set the cross-filter direction to "Single" from 'Products' to 'Sales', and we apply a filter on the 'Products' table (e.g.,
filtering for products with a certain category), only the sales transactions related to those products will be displayed.

 If we set the cross-filter direction to "Both", and we apply a filter on either the 'Products' table or the 'Sales' table (e.g., filtering
for a specific product category in 'Products' or a certain sales region in 'Sales'), the corresponding data in both tables will be
filtered accordingly.

 If we set the cross-filter direction to "Single" (Reverse) from 'Sales' to 'Products', and we apply a filter on the 'Sales' table (e.g.,
filtering for sales made within a specific time period), only the products related to those sales transactions will be displayed.
These cross-filter direction settings allow for flexible control over how filters interact between tables in your Power BI data model,
enabling you to create more nuanced and dynamic reports and visualizations.

Now edit our matrix visual as:

But note here month name is sorted alphabetically and we want it to be sorted according to its number in the year:
For this do this in Calendar table:

Result:

You might also like