Professional Documents
Culture Documents
Power Bi New
Power Bi New
2019
BY
ANALYTICS BENCHMARK
TRAININGS
VRXEROX
VR XEROX
ALL SOFTWARE MATERIALS,TRINING VIDEOS,SOFT COPIES AVAILABLE
CELL: 6300698155
Power BI Analytics Benchmark (AB) Trainings
Power BI - A Complete Introduction
Power BI
There are “N” numbers of Business Intelligence Tools both Traditional and Self serviced in the
Market from Different Vendors, below are the popular among them and their service provider.
Business Intelligence
Process of converting the data into Actionable Information or Business Insights called
as Business Intelligence.
Business Intelligence helps Business Managers to make more informed business
decisions.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
1. Traditional BI
2. Self-Serviced BI
In recent years, we observe that there has been an evolutionary shift from legacy, on
premise traditional Business Intelligence (BI) solutions to cloud-based, self-serviced BI.
Traditional BI
Traditional BI has been around for years and often requires a high-level technical skill
to implement, administer and maintain the solution. Another characteristic of traditional BI is
that it requires the solution to be housed on premise. For growing companies, this is a costly
and ineffective solution. Additionally, since traditional BI is typically a technical product, it’s
difficult for business users to have access to it.
Traditional Tools offers a broad range of features which allow companies to cover a
wide spectrum of reporting types and an array of use cases.
Requires a high level of technical expertise, users rely significantly on IT to perform
even the most basic functions like building reports. As a result, user adoption rates
may suffer.
Requires IT to have SQL query skills or learn a proprietary query language in order to
implement- which drives up cost and adds to the time required to deploy the solution.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Self Service BI
Business users are able to access the real-time data they want and quickly generate
results without the need for technical expertise. Often, no coding skills are required.
Self Service BI’s upfront costs, total cost of ownership (TCO) and total cost of change
(TCC) are significantly less than Traditional BI’s costs.
User adoption is typically greater with Self Service BI than with Traditional BI because
it’s easier for the non-technical business user to understand and leverage.
Cloud Based
On-Premise BI
Power BI Tools
o Power BI Desktop
Power Query
Power Pivot
Power View
o Power BI Service
o Power BI Report Server
o Power BI Mobile
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Power BI Desktop
Power BI Desktop is a tool to connect to, clean, model, and visualize your data.
With Power BI Desktop, you can connect to different data sources, transform the data
if required, model the data (Data Modeling) and visualize the data in different ways.
Power BI Desktop is the combination of below software’s
Power Query
Power Pivot
Power View
Power Query
Power Query is one piece of suite of Power BI. Power Query is used for data extraction
and transformation.
With the help of Power Query, we will connect to the different Data Sources and
Transform the data and then we will load the datasets into Power Pivot.
Transformed Data Sources in Power BI we called as Datasets.
The Power Query engine comes with a graphical tool and a formula language (M
Language) to transform the data.
With the help of predefined functions in the graphical tool we can transform the data
in power query. However, Power Query can be programmed to create custom
functions. This gives you seemingly unlimited potential to transform your data in just
about any way possible.
The formula language we used in Power Query is the M language to create the custom
functions.
Power Query can load the result set into Excel or into Power Pivot model.
Power Query not only makes all these tasks easier, but it also records your steps.
Power Pivot
Power Pivot is one piece of the suite of Power BI. Power Pivot is used for Data
Modeling.
Power Pivot is the place where we place the transformed data that is loaded by power
query for data modeling.
Power Pivot works on xVelocity In-Memory based tabular engine.
The In-Memory engine gives Power Pivot super-fast response time and the modeling
engine would provide you a great place to build your star schema, calculated measures
and columns, build relationships through entities and so on.
Power Pivot uses Data Analysis eXpression language (DAX) for building measures and
calculated columns.
DAX is a powerful functional language which contains multiple functions that are
helpful to create measures and calculated columns.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Power View
Power View is one piece of the suite of Power BI. Power View is used for data
Visualization.
With Power View you can create interactive charts, graphs, maps, and other visuals
that bring your data to life.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Limitations of Power BI Desktop
Power BI Service
Power BI Service is cloud based solution which is managed by Microsoft Corporation for
publishing, sharing and managing Reports and Dashboards.
Reports or Dashboards shared from Power BI Service can be accessed anywhere from
the world.
You can view the Reports or Dashboards that are shared with you with the help of web
browsers or Mobile Application (Power BI Mobile).
Power BI Report Server is a solution that customers deploy or install on their own
premises for publishing, sharing and managing reports and Dashboards.
Reports or Dashboards shared from Power BI Report Server can be accessed within the
Network only.
You can view the Reports or Dashboards that are shared with you with the help of web
browsers or Mobile Application (Power BI Mobile).
Power BI Mobile
Power BI Mobile is a mobile application which is used to see the Reports and
dashboards shared with us by logging with our server credentials.
Power BI Mobile App is available for Android, Apple, and Windows Phone, simply
download it from Google Play (Android), or App Store (Apple), or Windows Store
(Windows Phone) and install.
After the installation login with your server credentials (username and password), and
you’ll see Reports and Dashboards shared with you.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Preparing the data and Loading into Reporting Tool Power Query
Data Modeling and defining Metrics Power Pivot
Report generation Power View
Creating Dashboards, Sharing & Admin Activities Power BI Service or Power BI
Report Server
Viewing Reports & Dashboards Mobiles and Web Browsers.
The tools in the Power BI are not new into the market. Let us see the
history of Power BI.
Power Query is a free add-in in Excel 2010 and 2013 and it is inbuilt in Excel 2016.
Power Pivot is a free add-in in Excel 2010 and 2013 and it is inbuilt in Excel 2016.
Power View is a free add-in in Excel 2013 and it is inbuilt in Excel 2016.
Power BI Service is released on Jan 2015.
Microsoft combined Power Query, Power Pivot and Power View as Power BI Desktop
and released on July 2015.
Power BI Report Server was released on June 2017.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Data Transformation
Data transformation is the process of converting data or information from one format
to another, usually from the format of a source system into the required format of a new
destination system.
If existing Business model contains too many tables and many relationships between
tables makes a reporting query very slow and not efficient. Here we use Power Query to
Shape and Transform the data to build a star or snow flake schema by creating dimension
tables and fact table, which is more comfortable for report development.
Transactional databases are not best option for reporting purpose because
The model is hard to understand for a Report User.
Too many tables and many relationships between tables makes a reporting query (that
might use 20 of these tables at once) very slow and not efficient.
Also we don't need all the transactional data to be loaded into Reporting Tools we
just load whatever data we need for reports into our reporting tools.
In Power Query or Query Editor we will transform or shape the data using built-in GUI
transformations in the ribbon or using M language code.
On the flip side, storing data that has not been transformed wastes resources and
creates the possibility of compliance risk because the data cannot be managed under the
organization’s data governance rules.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Overview of Power Query / Query Editor
Power Query is a Data Extraction, Transformation and Loading Engine.
The Engine comes with a Graphical Tool and a Formula Language (M Language).
Power Query can connect to set of data sources and read data from them for data
preparation.
Once connected to any data source, then Queries (one for each table, or entity) are
listed and available for selection, viewing, and shaping.
The Graphical Tool has list of Transformations that can be applied on a data set or
Queries, and it also supports different data sources.
Power Query graphical interface is so easy to work with that even business analyst or
a power user can work with it, on the other hand Power Query M language is so
powerful that can be used for complex real world challenges of data transformations.
However, the Power Query formula language (M Language) is much more powerful
than the GUI. Actually there are some features in Power Query engine that not yet
has been implemented through GUI, but they are available through M Language.
Power Query can load the result set into Power Pivot for data modeling.
M is the formula language behind the scenes of Power Query. Everything you do in
the Query Editor will be translated to an M script. M contains full list of functions
that you can use. So the powerful side of Power Query is actually M. M is a functional
language and it has a simple structure.
Every data preparation steps or applied steps on Queries will be recorded and
displayed in Query Editor under Applied Steps Section.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Other way to get or open Query Editor is, go to Table Level Options you can find Edit Query.
Third way is while loading the table “Edit” option that takes you to the Edit Queries.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
With no data connections, Query Editor appears as a blank pane, ready for data as
shown below.
Once Query Editor is loaded with data that's ready for you to shape, you see a handful of
sections. Here’s how Query Editor appears once a data connection is established.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
1. In the ribbon, many buttons are now active to interact with the data in the query for data
preparation.
2. In the left pane or queries pane, queries (one for each table, or entity) are listed and
available for selection, viewing, and shaping.
3. In the center pane or Results Pane, data from the selected query is displayed and
available for shaping.
4. The Query Settings window appears, listing the query’s properties and applied steps.
5. The Formula bar is the place where you can see and edit the M code of the current
transformation step.
The ribbon
The queries pane
The data view / Results Pane
The Query Settings pane
Formula Bar
The ribbon in Query Editor consists of four tabs – Home, Transform, Add Column, and
View.
Home Tab
The Home tab contains the common query tasks, including the first step in any query,
which is Get Data. The following image shows the Home ribbon.
Transform Tab
The Transform tab provides access to common data transformation tasks, such as adding
or removing columns, changing data types, splitting columns, and other data-driven tasks.
The following image shows the Transform tab.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Add Column Tab
The Add Column tab provides additional tasks associated with adding a column,
formatting column data, and adding custom columns. The following image shows the Add
Column tab.
It’s useful to know that many of the tasks available from the ribbon are also available
by right-clicking a column, or other data, in the center pane.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
The Left Pane / Queries Pane
The left pane displays the number of active queries, as well as the name of the query.
When you select a query from the left pane, its data is displayed in the center pane, where
you can shape and transform the data to meet your needs. The following image shows the left
pane with multiple queries.
In the center pane, or Data pane, data from the selected query is displayed. This is
where much of the work of the Query view is accomplished.
Notice that many of these right-click menu items are the same as buttons in the ribbon tabs.
When you select a right-click menu item (or a ribbon button), Query applies the step
to the data, and saves it as part of the query itself. The steps are recorded in the Query
Settings pane in sequential order, as described in the next section.
The Query Settings pane is where all steps associated with a query are displayed. For
example, in the following image, the Applied Steps section of the Query Settings pane
reflects the fact that we just changed the type of the Overall score column.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
As additional shaping steps are applied to the query, they are captured in the Applied
Steps section.
It’s important to know that the underlying data is not changed rather Query Editor
adjusts and shapes its view of the data, and any interaction with the underlying data occurs
based on Query Editor’s shaped and modified view of that data.
In the Query Settings pane, you can rename steps, delete steps, or reorder the steps
as you see fit. To do so, right-click the step in the Applied Steps section, and choose from the
menu that appears. All query steps are carried out in the order they appear in the Applied
Steps pane.
Formula Bar
This is where you can see and edit the M code of the current transformation step. Each
transformation you make on your data is recorded and appears as a step in the applied steps
area.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
The Advanced Editor
If you want to see the code that Query Editor is creating with each step, or want to
create your own shaping code, you can use the Advanced Editor. To launch the advanced
editor, select View from the ribbon, then select Advanced Editor.
A window appears, showing the existing Query code. You can directly edit the code in
the Advanced Editor window. To close the window, select the done or Cancel button.
When your query is where you want it, you can have Query Editor apply the changes to
the data model into Power BI Desktop, and close Query Editor. To do that, select Close &
Apply from Query Editor's File menu as shown below.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Once you have your query where you want it, or if you just want to make sure your
work is saved, Power BI Desktop can save your work in the form of “. pbix” file.
To save your work, select File > Save (or File > Save As), as shown in the following image.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
In below diagram you can see a high level diagram of Power Query conceptually
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Data Type
Data Type represents the type of information stored in the memory location or
Column. Each column should have only one Data Type.
Change Data Type of a Column in Power BI
When you import or load a table from any data source, Power BI will automatically
detect the data type of a column. However, there may be some situations where Power BI
might get them wrong. For example, it may consider amounts, values, or even dates as the
text. Now we will see how to Change Data Types of a Column in Power BI with example.
Changing data type of the column is important as DAX functions have special data type
requirements and also filtering options will change based on data type of the column.
In Query Editor or Power Query you can change the Data Type of a column in different
ways.
Approach 1
In the below image for Units Sold Column, Power BI identified it as string column. But
actually we have Decimal Numbers as that column values.
So to change the data type, select the Column for which you want to change the data
type. Next, click on the left corner of the column header which is marked in Red Box. Then
select the data type which is appropriate, here Decimal Number.
Changing data type of a column will open the following pop up window. You can
Choose “Replace Current” to update current step or also you can choose “Add new step” to
add a new transformation step to the Query.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Approach 2
Select the Column name that you want to alter the data type, and click on the Data
Type button under the Home tab in Power Query Ribbon.
Approach 3
Select the Column that you want to change the data type and right-click on it will
open the context menu. Select the Change Type and then select the data type from the list.
For now, we are selecting the Decimal Number.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Filter a column using an Auto Filter / Basic Filtering
Select the column that you need to filter.
Click the down arrow ( ).
Uncheck the Select All box to deselect all Column Values.
Select the column values you want to include in your table.
Click OK.
Be careful if you are filtering the rows using Search Bar. Always look at the M code
return by Power Query and cross check it is filtering as expected.
Basic Filtering is good only if you want to do equity filtering for values that exists in
the current data set, however it won’t work correctly if you want to check ranges, or contains
or things that is not an exact equity filter. Advanced Filtering is the correct way of filtering in
Power Query, and there are advanced filters for all types of data types; Numbers, Text,
Date…
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When you filter a column, only the top 1,000 distinct values in the column will load
into the filter list. If there are 1,000 or more values in the column in Query Editor that you
are filtering, a message will appears indicating that the list of values in the filter list may be
incomplete, and the Load more link is shown. Click the Load more link to load another 1,000
distinct values.
If exactly 1,000 distinct values are found again, the list is displayed with a message
stating that the list could still be incomplete.
If less than 1,000 distinct values are found, the full list of values is shown.
Filter a Column using Text Filters
In addition to the “Auto Filters” or Basic Filtering, you can filter a Text values using
the Text Filters context menu.
Click the down arrow ( ) of the column containing a Text values you want to filter on.
Click Text Filters and select the filter option required from Context Menu.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Filter a Column using Number Filters
In addition to the “Auto Filters”, you can filter Number values using the Number
Filters Context Menu.
To filter a column using Number Filters, Click the down arrow ( ) of the column
containing a Number values you want to filter on.
Click Number Filters, and select the filter option required from Context Menu.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
In below image we applied filters on Row ID and Customer Name Column and you can
see M Language Code.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Inbuilt Column Transformations
Remove Columns / Remove Other Columns
Name / Rename a Column
Reorder Columns or Sort Columns
Add Column / Custom Column
Split Columns
Merge Columns
Pivot, Unpivot Columns
Transpose Columns
You can also remove columns from Manage Columns Section in Home Tab in Query
Editor Ribbon.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Name or Rename a Column
When you want give a meaningful name for a column that needs in Report, you can do
it by renaming a column. To rename a column
Right click a column Rename Enter a meaningful Name
(OR)
Double click the column that will allow you to edit Name Enter a meaningful Name
Once we select custom column a Custom Column window opens as below where we
can provide New column name and Custom column formula.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Split Columns
Sometimes you will get merged columns (one column with too much information). In
that situation, you can use Power BI Split Columns option to split that column into multiple
columns.
We have two options here to split columns as shown in below image.
By Delimiter
By Number of Characters
In order to split the columns in a table, right-click on the column that you want to
split will open the context menu. Select the Split Columns and then select “By Delimiter”
option.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Selecting the “By Delimiter” option will open the following window.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Each Occurrence of the delimiter
Text will split at each occurrence of a delimiter.
Split Columns by Number of Characters
Right-click on the column that you want to split will open the context menu. Please
select the Split Columns and then select “By Number of Characters” option.
Selecting the “By Number of Characters” option will open the Split Column by Number
of Characters window.
Number of Characters
Please specify the number of characters used to split the column. Let us give as 5.
Once, as far left as possible
This option will split the given string into two strings first string with first 5 Characters
and second string with remaining characters.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Once, as far right as possible
This option will split the given string into two strings first string with all the characters
except last 5 Characters and second string will be last 5 characters.
Repeatedly
Text will split for every 5 characters.
Merge Columns
With Power Query, you can merge two or more columns in your query. You can merge
columns to replace them with a merged column, or create a new merged column alongside
the columns that are merged.
Select two or more columns that you need to merge. Press the CTRL key, and then
click on the column headers to select each of the columns that you'll include in the merge.
NOTE: The order in which you select the columns sets the order of the values in the merged
column.
In the Merge Columns popup window, specify the separator that is in use between each of the
column values. You can select from predefined separator values, or specify a custom
separator value. Give a meaningful Name in “New column name” section.
Click OK to create a merge column that replaces the columns selected for the merge
operation.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Merge Columns to create a new column
Perform all the above steps in Add Column Tab in Query Ribbon to create a new
column for all the merged columns.
Turning columns to rows, or rows to columns is easy with Power Query and Power BI.
Transpose
This is used to reverse the rows and column of a table. Once you select the column
and click on transpose option the rows becomes columns and column becomes rows. For using
it click on Transpose option of Transform tab as below.
Region values are in Rows and Year Values are in columns in the below Query and we will use
this for Transpose.
Once after Transpose the result will looks like below. Year values in rows and Region values in
columns.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When power bi is not able to identify headers automatically, you can manually do that
using “Use First Row as Header”.
Reduce Rows
In case you want to filter the data you are importing, you have two options: either by
keeping the specific rows or removing rows. Both options can be found by clicking Home
Reduce Rows.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Keep Top Rows where you specify the number of top rows to keep.
Keep Bottom Rows for which you pick the number of bottom rows to keep.
Keep Range of Rows which skips a specified number of top rows and then keeps the
chosen number of rows.
In addition to the first three options, which work on whole tables, you have Keep
Duplicates and Keep Errors, both of which can work on either the whole table or the
selected columns only. For example, if you select the whole table and choose Keep
Duplicates, you will only see the rows that are complete duplicates of each other. However, if
you choose only one column and click Keep Duplicates, you will get the rows where the values
in the selected column are duplicates, regardless of other columns’ values.
Remove Top Rows Removes a specified number of top rows. Works on the whole table
only.
Remove Bottom Rows Removes a specified number of bottom rows. Works on the whole
table only.
Remove Alternate Rows Removes rows following a user-supplied pattern: it starts with a
specified row, then alternates between removing the selected number of rows and keeping
the chosen number of rows. Works on the whole table only.
Remove Duplicates Removes rows that are duplicates of other rows. Works on either the
whole table or the selected columns only.
Remove Blank Rows Removes rows that completely consist of either empty strings or nulls;
if you need to remove blank values from one column, you can click on the arrow to the right
of a column’s name and click Remove Empty. Remove Blank Rows Works on the whole table
only.
Remove Errors Removes rows that contain errors. Works on either the whole table or the
selected columns only.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Group rows / Group By
In Query Editor, you can group the values in multiple rows into a single value. This can
be useful when summarizing the number of products offered, the total sales, or the count of
students or total salary paid for each department.
Let’s summarize our EMP table by Deptno and Job wise TotSal, MinSal, MaxSal, CountOfEmp.
To do that, you can select Deptno and Job first, then click Home Transform
Group By (Or) Transform Table Group By. The Group By window then opens; you’ll see
a radio button to switch between Basic and Advanced settings. Specify one or more columns
to group by and how to aggregate data. To group by more than one column, switch to
Advanced settings, or you could have pre-selected multiple columns before clicking Group By.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Combine Queries
Combining more than one queries either horizontal or vertical we call it as Combine
Queries. Result of a combine operation on one or more queries will be only one query. You
can find Append Queries or Merge Queries in the Combine Queries section of the Query
Editor in Power BI. Append Queries will combine the queries data vertically. Merge Queries
will combine the queries data horizontally.
Append Queries
Append Queries means results of two (or more) queries will be combined vertically
into one query in the below way
Rows will be appended after each other. (For example appending a query with 50 rows
with another query with 100 rows, will return a result set of 150 rows)
Each Query should contain same number of columns and same datatype for columns
for better outputs. (For example col1, col2… col10 in first query, after appending with same
columns in the second query will result into one query with single set of col1, col2… col10)
Consider two sample data sets, one for each month sales,
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
To append these queries, click on one of them and select Append Queries from the
Combine section of Home tab in Query Editor.
If you want to keep the existing query result as it is, and create a new query with the
appended result choose Append Queries as New, otherwise just select Append Queries. In this
example I’ll do Append Queries as New, because I want to keep existing queries intact.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
You can choose what is the primary table (normally this is the query that you have
selected before clicking on Append Queries), and the table to append. In the append query
result you will see primary table values first and others next.
For this example, I have only two tables, so I’ll continue with above configuration.
Append Queries simply append rows after each other, and because column names are exactly
similar in both queries, the result set will have same columns.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Result of Append as simple as below. Append is similar to UNION ALL in T-SQL.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Query Editor Will opens From Home Tab selects New Source Select the type
of source for example Text/CSV as shown below Browse for the file location Select the
file Open.
Apply all steps above for each file to get multiple files into Query Editor for Appending.
Now all the three files are there in Query Editor as shown below. Now we will see how to
append them.
Select three or more tables Add tables from Available tables section to Tables to append
section
Change the order using up and down button as shown in above image, the way you are
expecting the data in append query result Ok. Now you will see an Append Query with the
data from all the three files we selected in the same order as we placed in Tables to append
section as shown below.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Appending multiple files of same type from a folder using single query
In the above example we append April, May and June files. Tomorrow let us assume
we get a file for July Month. In the above process you need to import it manually and need to
append all the four files. It’s a manual and lengthy process. Let’s see how we can automate it
by a single refresh and how to import and append with single query.
Open Query Editor Home New Source More...
Select Folder Connect Enter the folder Path where files are located
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Tomorrow when you get a new file, place it in the folder and simply refresh in Query
Editor. You will find updated data in Append Queries section.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Task
Append the data from multiple excel sheets in an excel workbook and multiple
workbooks or files in folder with a single query.
Excel.Workbook([Content])
Right-click options of a Query
When you right-click on the name of a query (in the left-most pane of Power Query's
window) you will see list of options a show below. We will discuss each of them now.
Copy
Copy option will copy the query and you can paste the query where ever you needed.
Paste
Paste is used to paste the copied query under the queries section.
Delete
Delete is used to delete a particular Query.
Rename
Rename will help you to rename a query.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Enable Load
Always remember that Query Editor is your ETL (Extract, Transform, and Load) engine.
It will apply all transformations before loading the data into the model, but once you finished
the transformation all queries will be loaded into the model and they take memory. By
default, all queries are enabled to Load into the model. Simply change that for queries that
are not required in the model by disabling the option “Enable Load”.
"Enable Load" means query results are available for report builder. Otherwise you may
use it in your other queries (for example to merge data), but it is not shown in the report
builder.
Include in report refresh
"Include in Report Refresh" means query is automatically refreshed when you press
"Refresh" button on the ribbon. Disable this option for the static tables to improve the
performance of report refresh.
Duplicate Query
Duplicate will duplicate the code of the query. Duplicate is generally used when you
would like to create a similar query and you do not want to type the same code. Once you
created a duplicate query from source query then duplicate query is independent of source
query. You can make changes to this duplicate query.
Reference Query
Reference Query means you would like to use that Query results in some other queries
where your original query remains as a base Query. Once you created a reference query from
source query then reference query is dependent of source query. When you make changes to
source query those will reflect in reference query. You can make additional changes to this
reference query.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Merge Queries
Merge Queries are used when we need to add one or more columns to a Query from
another Query. Merge is similar to JOINS in T-SQL or Other Databases.
Now we will see how to merge queries with an example. Take the EMP and DEPT
Queries as shown below.
EMP
DEPT
If you want to see employee details along with the department details in the same
query then you need to merge EMP, DEPT Queries. Now we will see how to merge both of
them.
Get both the Queries (EMP, DEPT) into Power Query. Select EMP Query first, and then
select Merge Queries (Merge Queries as New) from the Home tab on the ribbon as shown
below.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Next the Merge window appears prompting us to select the tables, matching columns
and Join Kind to create a merged table as shown below. We will discuss more about Join Kind
later.
Once you select tables, matching columns and Join Kind Then Ok button enabled.
Once you press OK, a NewColumn is created at the end of the query as shown below. The
NewColumn is the contents of the table (query) that was merged with the existing query. All
columns from the merged query are condensed into the NewColumn.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
To Expand the merged table, and select which columns to include, select the expand
icon ( ). The Expand window appears as shown below.
In this case, we only want the DNAME and LOC columns, so we select only that
columns and then select OK. We clear the checkbox from Use original column name as prefix
because we don’t need or want that, if we leave that selected, the merged column would be
named DEPT.DNAME, DEPT.LOC (the original column name, or NewColumn, then a dot, then
the name of the column being brought into the query).
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
You can easily use multiple columns in join condition for merging two data sets. Just
select them in an order with holding Ctrl key of the keyboard.
We use below EMP and DEPT Tables to illustrate these Join Types
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
EMP
EMPNO ENAME JOB MGR SAL DEPTNO
7369 SMITH CLERK 1001 800 20
7499 ALLEN SALESMAN 7566 1600 30
7521 WARD SALESMAN 7566 1250 30
7566 JONES MANAGER 7839 2975 20
7788 SCOTT ANALYST 7839 3000 20
7839 KING PRESIDENT 5000 10
7934 MILLER CLERK 1001 1300 10
1001 SUNIL TRAINER 7839 10000 50
DEPT
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
Left and Right
To start, you need to know the concept of Left and Right tables (or queries). When you
merge two data sets with each other, the first query is considered as LEFT and the second as
RIGHT.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
In the above example EMP is Left and First and DEPT is Right and Second.
Understanding this is important, because most of Join Kinds works with the concept of left or
right or both.
Left Outer (All from first, matching from second)
The first type of Join/Merge is Left Outer. All records from this query (LEFT or FIRST)
will be showed in the result set plus their matching rows in the right (or second Query). This
type of join is the default type. If you don’t specify the Join Kind, it will be always Left
Outer. The result set of EMP and DEPT with Join Kind Left Outer is shown below. We can see
that all the Rows from EMP table are shown in the result. We don’t have the DEPTNO=50 in
DEPT table still it is showing in the merged query result as we select Left Outer Join Kind.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Inner (only matching rows)
This Join Kind will only return matching rows as shown below. You will not have any
record with null values (because these records generate as a result of not matching).
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Right Anti (rows only in second)
This Join Kind will give you only non-matching rows, this time from the Second (Right)
Query. You can find out what rows in the Right or Second Query are not matching with the
Left or First Query.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Power BI Modeling
In this section, we will learn about Modeling Data, relationships, their definition, use,
and how to create relationships, different types of relationships in Power BI. After this, we
will learn how to manage relationships in Power BI. Managing relationships means adding,
editing, and deleting relationships as well as making these active or inactive.
Power BI can connect to different data source, Transform or Prepare the Data using
Power Query or Query Editor and then Load the transformed data into Power Pivot, to
perform data modeling.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Data Modeling
Modeling is to create a connection between different queries or tables, for that you
create a relationship.
Often, you'll will use fields from more than one Query to create your Visualizations,
and you'll need all of that data to work together. Modeling is how you get it there.
Usually in OLAP systems we stores discriptive information in Dimension Tables and
Numeric information that is helpful for Analyzing the business will be stored in Fact Table. We
always use the dimension table along with fact table to build reports or visualizations.
Relationship
As the name suggests, Relationship in Power BI is used to define the connections or the
relation between two or more tables. The relationship is used when we want to perform an
analysis based on multiple tables. Relationship helps us to display the data and correct
information between multiple tables. It is used to calculate the accurate results also.
A relationship between data sources enables Power BI to know how those tables relate
to one another, allowing you to create interesting visuals and reports.
Power BI Desktop will create the relationships for you automatically. It is important to
verify these auto-detected relationships to ensure accuracy.
Need of Relationship
If we don’t have relationship between two tables which are using in the same
visualization for analysis, throws error as shown below or else it will show wrong results.
When you Click the See details hyperlink, you will be getting the message as shown in below
image.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Relationship Types / Cardinality in General
There are three types of relationships or Cardinality betweeen tables
One-to-One
One-to-Many (or Many-to-One)
Many-to-Many
One-to-One
A row in table A can have only one matching row in table B, and vice versa.
This is the most common relationship type. In this type of relationship, a row in table
A can have many matching rows in table B, but a row in table B can have only one matching
row in table A.
Sales table is the “many” and the Customer table is the “one”. Customer Table will
have customer record only onces but a Sales table will have multiple sales values for the same
customer. When you see from Sales table to Customer Table it is Many-to-One relationship
similarly when you see from Customer Table to Sales Table it is One-to-Many relationship.
Many-to-Many
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
The first thing you should do after importing data is to verify that all auto-detected
relationships have been created correctly. From the modeling ribbon, select Manage
Relationships.
This will open up the Manage Relationships editor. The relationship editor is where you
will go to create new relationships, Autodetect Relationship and edit or delete existing
relationships. The relationship editor will be used to verify the relationships that were
automatically created by Power BI Desktop.
Let's take a look at the Manage Relationships editor, in which you can manage or
perform the following.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
First, you need to verify auto-detected relationships. The top half of the relationship
editor gives you a quick and easy way to see what tables have relationships between them,
what columns the relationships have been created on, and if the relationship is an active
relationship.
Click Manage Relationships. In Manage Relationships Window, click New. This opens
the Create Relationship dialog / Window, where we can select the tables, columns,
and any additional settings we want for our relationship.
For the first table, select SALES_DATA, then select the CustomerKey column in
SALES_DATA table. This is the many side of our relationship.
For the second table, select CUSTOMERS_DATA, then select the CustomerKey column.
This is the one side of our relationship.
Go ahead and click OK in the Create Relationship dialog and the Manage Relationships
dialog Cick on close.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Editing relationships
Now, let's take a look at how to edit an existing relationship. In this example, you will
edit the relationship between FactInternetSales and DimCustomer. To edit an existing
relationship, select that relationship and then click on Edit.
Once you select Edit... you will receive a new dialog box, this is the Edit Relationship
editor. In this view, you will see how to change an existing relationship, how to change a
relationship to active or inactive, and the cardinality of the current relationship, this is also
where you can change the cross filter direction if required.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
There are five things we want to look at in the edit relationship window
1. This identifies the FactInternetSales table and the column that the relationship was
built on.
2. This identifies the DimCustomer table and the column that the relationship was built
on.
3. This checkbox identifies whether the relationship is active or inactive.
4. This is the current cardinality or relationship type between the two tables. Here we
see that there is a many-to-one relationship between FactInternetSales and
DimCustomer. Power BI does an excellent job of identifying the correct cardinality,
but it is important to always verify that the cardinality is correct.
5. The cross filter direction can be single or both. The one side of a relationship
always filters the many side of the relationship, and this is the default
behavior in Power BI. If you filter values in dimension table corresponding values in
fact table will be shown. The cross filter option allows you to change this behavior.
Cross filtering will be discussed later in this chapter.
When connecting to a data source using DirectQuery, you can use the Assume
Referential Integrity selection to enable running more efficient queries against your data
source. When we are using DirectQuery, every time when we drag the fields to visualizations,
Power BI will run Queries on top of Source Databases. This feature has a few requirements of
the underlying data, and it is only available when using DirectQuery.
Setting Assume referential integrity enables queries on the data source to use INNER
JOIN statements rather than OUTER JOIN, which improves query efficiency.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Requirements for using Assume referential integrity to Give Correct Values
This is an advanced setting, and is only enabled when connecting to data using
DirectQuery. The following requirements are necessary for Assume referential integrity to
work properly.
The following example demonstrates how Assume referential integrity behaves when used in
data connections. The example connects to a data source that includes an Orders table, a
Products table, and a Depots table.
1. In the following image that shows the Orders table and the Products table, note that
referential integrity exists between Orders[ProductID] and Products[ProductID]. The
[ProductID] column in the Orders table is never Null, and every value also appears in
the Products table. As such, Assume Referential Integrity should be set to get more
efficient queries (using this setting does not change the values shown in visuals).
2. In the next image, notice that no referential integrity exists between Orders[DepotID]
and Depots[DepotID], because the DepotID is Null for some Orders. As such, Assume
Referential Integrity should not be set.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
To enable this feature, select the checkbox next to Assume Referential Integrity as
shown in the following image.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When selected, the setting is validated against the data to ensure there are no Null or
mismatched rows. However, for cases with a very large number of values, the validation is
not a guarantee that there are no referential integrity issues.
In addition, the validation occurs at the time of editing the relationship, and does not
reflect any subsequent changes to the data.
If you set Assume Referential Integrity when there are referential integrity issues in
the data, this will not result in errors. However, it will result in apparent inconsistencies in
the data. For example, in the case of the relationship to the Depots table described above, it
would result in the following.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Many-to-many relationships in Power BI Desktop - Preview July2018
With the Many-to-many relationship feature in Power BI Desktop you can join tables
using a cardinality of Many to Many, and create data models that contain multiple data
sources easier and more intuitively.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
You'll need to restart Power BI Desktop for the feature to be enabled.
For example, two tables may have a column containing the Country, but the values of Country
were not unique in either table. To join between such tables, it was necessary to create a
workaround such as introducing additional tables into the model that contained the necessary
unique values. The feature many-to-many relationships provides an alternative approach,
allowing such tables to be joined directly using a relationship with a cardinality of Many-to-
many.
www.abtrainings.com
Introduction to DAX
What is DAX?
DAX stands for Data Analysis eXpressions, and it is the formula language used in
Power BI. DAX is also found in other offerings from Microsoft, such as Power Pivot and SSAS
Tabular.
DAX is a functional language, which means the full executed code is contained inside a
function.
There are two primary calculations you can create using DAX
Calculated Columns
Measures
Whether you're creating a New Column or Measure, it's important to know the general
format of table names in DAX.
'Table Name'[ColumnName]
If there are spaces in the table name (as shown above), the single quotes around the
table name are mandatory. If the table name has no spaces, the single quotes can be
omitted, so the syntax looks like the following. Column names must always include the square
brackets.
TableName[ColumnName]
Calculated Columns are useful when you want a calculation for every row in your
table.
You can create Calculated Columns in Power BI Desktop by selecting New Column from
the Modeling tab. It's best to be in Data view (rather than Report or Relationships view), since
you can see the New Column created and the Formula Bar is populated and ready for your
DAX formula.
Once you select the New Column button, the Formula Bar is populated with a basic
column name (which you change to suit your formula, of course) and the = operator, and the
new column appears in the data grid, as shown in the following image.
Use a calculated measure when you are calculating percentages or ratios, or you need
complex aggregations. To create a measure using a DAX formula, select the New Measure
button from the Modeling tab. Again, it's best to be in the Data view of Power BI Desktop
since it shows the Formula Bar and makes it easy to write your DAX formula.
With measures, you see a new measure icon appear in the Fields pane with the name
of the measure. The Formula Bar is again populated with the name of your DAX formula (this
time, with your measure).
The required elements for a calculated measure are the same as they are for a calculated
column
Implicit Measures are created when you drag raw numerical fields (like Sales, Profit,
Quantity) into the values field well of a visual and manually select the aggregation mode
(Sum, Average, Min/Max, etc.).
Explicit measures are created by actually entering DAX functions like below
Implicit measures are only accessible within the specific visualization in which it was
created, and cannot be referenced elsewhere.
Explicit measures can be used anywhere in the report and referenced with other DAX
calculations.
Recalculate on data source refresh or when Recalculate in response to any change to filters
changes are made to component columns within the report or when we add another
which are used to derive Calculated Columns dimension to the visualization.
Primarily used as rows, columns, slicers or Almost always used within the values field of a
filters in Visualizations visuals
Calculated Column Name Should be unique at
Measure Name Should be unique thought the Model
Table Level
DAX Syntax & Operators
B) The equals sign operator (=) indicates the beginning of the formula. When calculated, it
will return a result.
C) The DAX function SUM adds up all of the numbers in the Sales [SalesAmount] column. You’ll
learn more about functions later.
F) The referenced column [SalesAmount] in the Sales table. With this argument, the SUM
function knows on which column to aggregate a SUM.
DAX Operators
The Data Analysis Expression (DAX) language uses operators to create expressions that
compare values, perform arithmetic calculations, or work with strings.
Types of Operators
Arithmetic Operators
Comparison Operators
You can compare two values with the following operators. When two values are
compared by using these operators, the result is a logical value, either TRUE or FALSE.
Use the ampersand (&) to join, or concatenate, two or more text strings to produce a
single piece of text.
EX: State and Country = CONCATENATE (Orders [State], CONCATENATE (", ", Orders
[Country]))
Or
State and Country = Orders [State] & ", " & Orders [Country]
Logical Operators
Use logical operators (&&) and (||) to combine expressions to produce a single result.
DAX provides the following types or Categories of functions which we mostly used.
Mostly we used Date and Time functions to create Calculated Columns / New Columns.
Let’s us discuss about below date functions.
YEAR
MONTH
DAY
WEEKDAY
WEEKNUM
FORMAT (Text Function) Month Name, Weekday Name
DATE
TODAY
NOW
HOUR
MINUTE
SECOND
TIME
DATEDIFF
CALENDAR
EOMONTH
STARTOFMONTH
Creating Calculated Columns form Date Fields
Month Name = Format (Orders [Order Date],"MMMM") Gives full Month Name
Month Name = Format (Orders [Order Date],"MMM") Gives Month Name abbreviations
Weekday Name = FORMAT (Orders [Order Date],"DDDD") Gives Full Weekday Name
Weekday Name = FORMAT (Orders [Order Date],"DDD") Gives Weekday Name abbreviations
DATEDIFF
Calculated Tables
In a calculated table, the table values are generated by Data Analysis Expression (DAX)
and the values are stored in the Power BI model. Usually using Calculated Tables, we will
create Date Dimension table and use this table in the model for time series analysis.
Every Time creating this date fields for different data sets is difficult, so what we do is
we create a Date Dimension Table which contains all these fields and use it.
The calendar function returns a table with a single column that contains a continuous
set of dates. The start and end date range will be supplied as parameters.
The following formula returns a calculated table Date_Dim with dates between January 1st,
2011 and December 31st, 2020.
Day = DAY(Date_Dim[Date])
WeekDay = WEEKDAY(Date_Dim[Date])
WeekDayName = FORMAT(Date_Dim[Date],"DDDD")
Month = MONTH(Date_Dim[Date])
MonthName = FORMAT(Date_Dim[Date],"MMMM")
Quarter = ROUNDUP((Date_Dim[Month]/3),0)
Quarter = IF (Month Number<4,"Qtr 1”, IF (Month Number<7,"Qtr 2”, IF (Month
Number<10,"Qtr 3","Qtr 4")))
QuarterName = "Qtr" & Date_Dim[Quarter]
QuarterName = CONCATENATE ("Qtr", Date_Dim[Quarter])
Year = YEAR(Date_Dim[Date])
WeekNumber = WEEKNUM(Date_Dim[Date])
WeekNumMonth = 1 + WEEKNUM (Dim_Date[Date]) -
WEEKNUM(STARTOFMONTH(Dim_Date[Date]))
WeekNameMonth = "Week" & " " & Date_Dim[WeekNumMonth]
Week of Month
The week number of the month is, one plus the difference between the weeknum for
the date and the weeknum of the first of the month.
EOMONTH
EOMONTH Returns the date in datetime format of the last day of the month, before or after a
specified number of months. Use EOMONTH to calculate maturity dates or due dates that fall
on the last day of the month.
Syntax
Example
1. If customer taken a loan for 12 months, to find when the loan will complete use below
syntax.
2. Based on Order Date filed in Orders table, get the Number of Days in that month.
No of Days in Month = DAY ((EOMONTH (Orders [Order Date], 12)))
Power BI Analytics Benchmark (AB) Trainings
DAX Logical Functions
Microsoft Power BI DAX provides various Logical Functions as shown below
IF
TRUE
FALSE
NOT
OR
IN
AND
IFERROR
SWITCH
Now we will see how to use Power BI DAX Logical Functions with examples.
IF Function
The DAX IF function is used to check the given expression is True or False. The basic
syntax of the Power BI DAX If Function is as shown below
Syntax
As you can see from the above syntax, this function accepts three arguments. First
argument is the Boolean expression (which return true or false). If the expression results
TRUE then second argument will return otherwise, third argument will return.
Syntax in Square Brackets is optional. If you are not providing third argument, then if
the condition is not satisfied it will return NULL values.
Examples
In Power BI DAX, you can use the Nested If concept, One If statement inside another.
Below statement will check whether the Sales amount of each column is less than 100 or not.
If true then column will return “Low Sales” otherwise, it will enter into Nested If.
Examples
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
DAX TRUE & False Function
The DAX TRUE function will return a logical value True. The DAX FALSE function will
return logical False.
The DAX NOT function will convert True to False, and False to True. I mean, it returns
opposite result. The syntax of the Power BI DAX NOT Function is as shown below
NOT(Condition)
NOT(<logical>)
Example
NOT example = NOT(IF(Orders[Sales]>100, TRUE (), FALSE ()))
DAX OR Function
The DAX OR function is like either or statement in English, which is used to check
multiple expressions. The syntax of the Power BI DAX OR Function is as shown below.
OR (Condition 1, Condition 2)
OR (Logical1, Logical2)
Example
Weekday = WEEKDAY (Orders [Order Date])
Weekend = IF(OR(Orders[Weekday]=1, Orders[Weekday]=7),"Weekend", "Weekday")
Weekend = IF(Orders[Weekday]=1 || Orders[Weekday]=7,"Weekend", "Weekday")
DAX IN Function
The DAX AND function is used to check multiple expressions. The syntax of the Power
BI DAX AND Function is as shown below
AND (Condition 1, Condition 2)
AND (Logical1, Logical2)
As you can see from the above syntax, DAX AND function accepts two arguments. If
both the conditions are True then it will return True otherwise, it return False.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Examples
The DAX IFERROR function is very useful to handle the arithmetic overflow, or any
other errors. It simply performs calculation and return the result, if there is an error then it
will return the value inside the second argument. The syntax of the DAX IFERROR Function is
as shown below.
Below statement will return 100 if error occurs. Indeed, all the records will throw error
because we are dividing them 0. If there is no error, it will give calculation or expression
value.
The DAX SWITCH function helps you to return multiple options. For example, IF
statement will return either True or false. However, you can use this switch case to multiple
results. The syntax of the DAX SWITCH Function is as shown below.
If Month of Order Date is 1 then below statement will return January, 2 means
February, 3 means March, 4 means April, 5 means May, 12 means December otherwise,
Unknown.
Switch Example = SWITCH (TRUE (), Orders [Sales]<100, "Low Sales”, Orders[Sales]>300,"High
Sales”, “Medium Sales")
SWITCH () always test for equivalence. SWITCH () is still testing for equivalence! By providing
the first argument as TRUE (), now each subsequent “test” is going to be checking for TRUE
(). And since each of our inequality tests results in either TRUE () or FALSE () as a value, the
test case that evaluate to TRUE () is the one that gets matched, and therefore the one that
gets used. For instance, if [Measure] <1 evaluates to TRUE (), then expr1 gets returned.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Text Functions in DAX
LEN
LEN function will Returns the Number of characters in string.
Syntax
LEN (<Text>)
Example
Length = LEN (Orders [Customer Name])
CONCATENATE (&)
CONCATENATE function joins two text strings into one text string.
Syntax
CONCATENATE (<Text1>, <Text2>)
Example
Concat = CONCATENATE (Orders [Category], CONCATENATE (" - ", Orders [Sub-Category]))
Concatenate = Orders [Category] & " - " & Orders [Sub-Category]
LEFT
LEFT Function Returns the specified number of characters from the start of a text string.
Syntax
LEFT (<text>, <num_chars>)
num_chars optional, if omitted, 1.
Example
Left = LEFT (Orders [Country], 5)
RIGHT
RIGHT function returns the last character or characters in a text string, based on the number
of characters you specify.
Syntax
RIGHT (<text>, <num_chars>)
num_chars optional, if omitted, 1.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Example
Right = RIGHT (Orders [Country], 5)
MID
MID Function Returns a string of characters from the middle of a text string, given a starting
position and length.
Syntax
MID (<text>, <start_num>, <num_chars>)
Example
Mid = MID (Orders [Country], 8, 5)
UPPER
UPPER Function Converts a text string to all uppercase letters
Syntax
UPPER (<text>)
Example
Upper = UPPER (Orders [Country])
LOWER
Lower Function Converts all letters in a text string to lowercase.
Syntax
LOWER (<text>)
Example
Lower = LOWER (Orders [Country])
TRIM
TRIM Function Removes all spaces from text except for single spaces between words.
Syntax
TRIM (<text>)
Example
Trim = TRIM (Orders [Customer Name])
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
SUBSTITUTE
SUBSTITUTE Function Replaces existing text with new text in a text string.
Syntax
SUBSTITUTE (<text>, <old_text>, <new_text>, <instance_num>)
instance_num optional, if omitted, every instance of old_text is replaced with new_text.
Example
Substitute = SUBSTITUTE (Orders [Country], "t", "T") – Replace existing text with new text for
all occurrences
Substitute = SUBSTITUTE (Orders [Country], "t", "T", 2) - Replace existing text with new text
for second occurrence only.
BLANK
Returns a blank.
Syntax
BLANK ()
Example
The following example illustrates how you can work with blanks in formulas. The
formula calculates unit price. However, before attempting to calculate the ratio the
denominator should be checked for zero values. If the denominator is zero then a blank value
should be returned, otherwise, the ratio is calculated.
Blank = IF (Orders[Quantity] = 0, BLANK (), Orders[Sales]/ Orders[Quantity])
Usage
Avoids ‘Divide by zero’ error.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Math and Statistical Functions
INT
INT Rounds a number down to the nearest integer.
Syntax
INT (<number>)
Example
INT Example = INT (Orders [Sales])
12.34 =12 12.78 = 12 12.55=12
ROUND
Round function will Rounds a number to the given number of digits.
Syntax
ROUND (<number>, <num_digits>)
Example
Round Example = ROUND (Orders [Sales], 0)
12.34 =12 12.78 = 13 12.55=13
Round Example = ROUND (Orders [Sales], 1)
12.34 =12.3 12.78 = 12.8 12.55=12.6
ROUNDUP
Roundup will Rounds a number to next integer value if num_digits = 0.
Syntax
ROUNDUP (<number>, <num_digits>)
Example
ROUNDUP Example = ROUNDUP (Orders [Sales], 0)
12.34 =13 12.78 = 13 12.55=13
ROUNDUP Example = ROUNDUP (Orders [Sales], 1)
12.34 =12.4 12.78 = 12.8 12.55=12.6
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
ROUNDDOWN
ROUNDDOWN Rounds a number down, toward zero.
Syntax
ROUNDDOWN (<number>, <num_digits>)
Example
ROUNDDOWN Example = ROUNDDOWN (Orders [Sales], 0)
12.34 =12 12.78 = 12 12.55=12
ROUNDDOWN Example = ROUNDDOWN (Orders [Sales], 1)
12.34 =12.3 12.78 = 12.7 12.55=12.5
DIVIDE
Performs division and returns alternate result or BLANK () on division by 0.
Syntax
DIVIDE (<numerator>, <denominator>, [<alternateresult>])
Example
Divide Example = DIVIDE (Orders [Sales], Orders [Quantity], 0)
Divide Example = DIVIDE (200,4,0) = 50
Divide Example = DIVIDE (100,0, -1) = -1
EVEN
Returns number rounded up to the nearest even integer.
Syntax
EVEN (number)
Example
Even Example = EVEN (Orders [Sales])
12.34 =14 12.78 = 14 12.55=14
13.34 =14 13.78 = 14 13.55=14
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
ODD
Returns number rounded up to the nearest odd integer.
Syntax
ODD (number)
Example
Odd Example = ODD (Orders [Sales])
12.34 =13 12.78 = 13 12.55=13
13.34 =15 13.78 = 15 13.55=15
POWER
Returns the result of a number raised to a power.
Syntax
POWER (<number>, <power>)
Example
Power Example = POWER (Orders [Quantity], Orders [Quantity])
Power Example = POWER (Orders [Quantity],2)
Power Example = POWER (4,2) 16
Power Example = POWER (3,3) 27
SIGN
SIGN determines the sign of a number, the result of a calculation, or a value in a column. The
function returns 1 if the number is positive, 0 (zero) if the number is zero, or -1 if the number
is negative.
Syntax
SIGN (<number>)
Example
Sign Example = SIGN (Orders [Sales])
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
SQRT
SQRT returns the square root of a number. If the number is negative, the SQRT function
returns an error.
Syntax
SQRT (<number>)
Example
SQRT Example = SQRT (Orders [Quantity])
SQRT Example = ROUND (SQRT (Orders [Quantity]), 2)
FACT
Returns the factorial of a number, equal to the series 1*2*3*..., ending in the given number.
Syntax
FACT (<number>)
Example
FACT Example = FACT (Orders [Quantity])
SUM
SUM Function Adds all the numbers in a column.
Syntax
SUM (<column>)
Example
Sum of Sal = SUM (EMP [SAL])
SUMX
Returns the sum of an expression evaluated for each row in a table.
Syntax
SUMX (<table>, <expression>)
SUMX of Sal = SUMX (EMP, EMP [SAL] +EMP [COMM])
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
MIN
Returns the smallest numeric value in a column.
Syntax
MIN (<column>)
Example
Min of Sal = MIN(EMP[SAL])
MINX
Returns the smallest numeric value that results from evaluating an expression for each row of
a table.
Syntax
MINX (<table>, <expression>)
Example
MINX of Sal = MINX (EMP, EMP [SAL]+ EMP [COMM])
MAX
Returns the largest numeric value in a column.
Syntax
MAX (<column>)
Example
MAX of Sal = MAX(EMP[SAL])
MAXX
Evaluates an expression for each row of a table and returns the largest numeric value.
Syntax
MAXX (<table>, <expression>)
Example
MAXX of Sal = MAXX (EMP, EMP [SAL]+ EMP [COMM])
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
COUNT
Counts the number of cells in a column that contain numbers.
Syntax
COUNT (<column>)
Example
COUNT Example = COUNT(EMP[SAL])
Count Example1 = COUNT (EMP [COMM])
COUNTX
Counts the number of rows that contain a number or an expression that evaluates to a
number, when evaluating an expression over a table.
Syntax
COUNTX (<table>, <expression>)
Example
COUNTX Example = COUNTX (EMP, EMP[SAL]+EMP[COMM])
AVERAGE
AVERAGE Function Will Returns the average of all the numbers in a column.
Syntax
AVERAGE (<column>)
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Example
Average Example = AVERAGE(EMP[SAL])
Average of COMM = AVERAGE(EMP[COMM])
AVERAGEX
Calculates the average of a set of expressions evaluated over a table.
Syntax
AVERAGEX (<table>, <expression>)
Example
AVERAGEX Example = AVERAGEX (EMP, EMP[SAL]+EMP[COMM])
COUNTROWS
Counts the number of rows in the specified table, or in a table defined by an expression.
Syntax
COUNTROWS (<table>)
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Example
COUNTROWS Example = COUNTROWS(EMP)
COUNTBLANK
Counts the number of blank cells in a column.
Syntax
COUNTBLANK (<column>)
Example
COUNTBLANK Example = COUNTBLANK(EMP[COMM])
RANKX
The RANKX function is used in DAX to create rankings.
Ranks allow you to easily compare products, salespeople or anything else that you
want to evaluate the performance.
RANKX is a scalar function and it is also an iterator. The RANKX function can optionally
take a Value argument that represents a scalar value whose rank is to be found. The optional
Order argument specifies how to rank Value, descending (0) or ascending (1). The optional
Ties argument defines how to determine ranking when there are ties (Same Ranks). Skip
(default) will use the next rank value after a tie, and Dense will use the next rank value (i.e.
there will be no gaps in the rank numbers).
Optional arguments might be skipped by placing an empty comma (,) in the argument
list, i.e. RANKX = RANKX (EMP, EMP[SAL],,,Dense)
Syntax
RANKX (TABLE, EXPRESSION [, VALUE] [, ORDER] [, TIES]…)
Dense – will not Skip Between Rank Numbers
Examples
RANKX = RANKX (EMP, EMP[SAL])
Category Rank =
-- STEP 3. Rank my expression against the sorted list from 2.
RANKX (
-- STEP 1. Loop the rows in this table
ALL(EMP[DEPTNO]),
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
-- STEP 2. Run this expression for each loop
CALCULATE (
SUM(EMP[SAL])
)
)
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
CALCULATE
Evaluates a given expression or formula under a set of defined filters. If we Know that
in many visualizations, we want to show only a sub set of data instead of creating
visualizations and filtering we will filter the measure value using CALCULATE Function.
Syntax
Task: Calculate Sum of Sales for Region is equal to “South” or Segment is equal to “Home
Office”.
Sales South Home Office = CALCULATE(sum(Orders[Sales]), Orders[Region]="South" ||
Orders[Segment]="Home Office") – Throws error as shown below
FILTER
The FILTER function is used to return a subset of a table or expression
In many cases you can use the CALCULATE function instead of the FILTER function to
produce the same results (the resulting formula is usually easier to understand, too).
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
ALL
Returns all the rows in a table, or all the values in a column, ignoring any filters that
might have been applied. This function is useful for clearing filters and creating calculations
on all the rows in a table.
Syntax
<table> | <column>
The table or column that you want to clear filter on. If it column you can add
multiple columns to clear filter.
Examples
ALLEXCEPT
Removes all context filters in the table except filters that have been applied to
the specified columns.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
RELATED
***USERELATIONSHIP
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Time Intelligence
What is Time Intelligence?
Time Intelligence means doing calculations over periods of time or dates. All the Time
Intelligence Functions will need a date column to perform the calculations, and this date
column should contain unique, no null and contiguous date values to get the accurate
results.
Time Intelligence simply means doing BI calculations over periods of time, or over
dates. For example, a common request in many reports is to show a value, such as Sales,
aggregated month-by-month, from the beginning of each year, so that you know, in this case,
what were the total sales, in that year, up to the given month. DAX, Data Analysis
Expressions, the language of Power BI, includes many predefined time intelligence functions,
including TOTALYTD, which is exactly the function you need to use in this particular
scenario.
Many data analysts prefer to create their own date tables, which is fine. In Power BI
Desktop, you can specify the table you want your model to use as its date table, and
subsequently create date-related visuals, tables, measures, and so on, using that table's date
data. When you specify your own date table, you control the date hierarchies created in your
model, and use them in measures and other operations that use your model's date table.
To make DAX Time Intelligence functions work properly set date dimension table as
“Mark as date table”.
Setting your own date table
To set a date table select the table you want to use as a date table in the Fields pane,
then right-click the table and select Mark as date table Mark as date table in the menu
that appears, as shown in the following image.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
You can also select the table and then select Mark as Date Table from the Modeling
ribbon, shown here.
When you specify your own date table, Power BI Desktop performs the following
validations of that column and its data, to ensure that the data
contains unique values
contains no null values
contains contiguous date values (from beginning to end)
if it is a Date/Time data type, it has the same timestamp across each value
Once you specify a date table, you can select which column in that table is the date
column. You can specify which column to use by selecting the table in the Fields pane, then
right-click the table and select Mark as date table Date table settings. The following
window appears, where you can select the column to use as the date table from the drop-
down box.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
All the Time Intelligence Functions will need a date column to perform the
calculations, and this date column should contain unique, no null and contiguous date values
to get the accurate results.
TOTALMTD
Evaluates the value of the expression for the month to date, in the current context.
TOTALMTD will give Running Totals or cumulative sum for each Month.
Example
TOTALQTD
Evaluates the value of the expression for the dates in the quarter to date, in the
current context. TOTALQTD will give Running Totals or cumulative sum for each Quarter.
Example
Total QTD = TOTALQTD(SUM(Orders[Sales]), Dim_Date[Date])
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
TOTALYTD
Evaluates the year-to-date value of the expression in the current context. TOTALYTD
will give Running Totals or cumulative sum for each year.
Example
PREVIOUSDAY
Returns a table that contains a column of all dates representing the day that is
previous to the first date in the dates column, in the current context.
Example
Previous Day = CALCULATE(SUM(Orders[Sales]), PREVIOUSDAY(Dim_Date[Date]))
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
PREVIOUSMONTH
Returns a table that contains a column of all dates from the previous month, based on
the first date in the dates column, in the current context.
Example
Previous Month = CALCULATE(SUM(Orders[Sales]), PREVIOUSMONTH(Dim_Date[Date]))
PREVIOUSQUARTER
Returns a table that contains a column of all dates from the previous quarter, based
on the first date in the dates column, in the current context.
Example
Previous Quarter = CALCULATE(SUM(Orders[Sales]), PREVIOUSQUARTER(Dim_Date[Date]))
PREVIOUSYEAR
Returns a table that contains a column of all dates from the previous year, given the
last date in the dates column, in the current context.
Example
Previous Year = CALCULATE(SUM(Orders[Sales]), PREVIOUSYEAR(Dim_Date[Date]))
NEXTDAY
Returns a table that contains a column of all dates from the next day, based on the
first date specified in the dates column in the current context.
Example
Next Day = CALCULATE ([Sum of Sales], NEXTDAY(Dim_Date[Date]))
NEXTMONTH
Returns a table that contains a column of all dates from the next month, based on the
first date in the dates column in the current context.
Example
Next Month = CALCULATE ([Sum of Sales], NEXTMONTH(Dim_Date[Date]))
NEXTQUARTER
Returns a table that contains a column of all dates in the next quarter, based on the
first date specified in the dates column, in the current context.
Example
Next Quarter = CALCULATE ([Sum of Sales], NEXTQUARTER(Dim_Date[Date]))
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
NEXTYEAR
Returns a table that contains a column of all dates in the next year, based on the first
date in the dates column, in the current context.
Example
Next Year = CALCULATE ([Sum of Sales], NEXTYEAR(Dim_Date[Date]))
SAMEPERIODLASTYEAR
Returns a table that contains a column of dates shifted one year back in time from the
dates in the specified dates column, in the current context.
Example
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Year Over Year (YOY Growth)
Current Year Sales = SUM(Orders[Sales])
Last Year Sales = CALCULATE (SUM(Orders[Sales]), SAMEPERIODLASTYEAR(Dim_Date[Date]))
% YOY = DIVIDE ([Current Year Sales], [Last Year Sales], "NO LY Data")
MOM Growth
Sum of Sales = SUM(Orders[Sales])
Last Month Sales = CALCULATE(SUM(Orders[Sales]), PREVIOUSMONTH(Dim_Date[Date]))
% MOM = DIVIDE ([Sum of Sales], [Last Month Sales])
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Report View / Power View in Power BI Desktop
Power BI Desktop includes Report View, where you can create any number of report
pages with visualizations. Report View in provides pretty much the same design experience as
a report’s Editing View in the Power BI service. You can move visualizations around, copy and
paste, merge, etc.
The difference is, when using Power BI Desktop, you can work with your queries and
model your data to make sure your data supports the best insights in your reports. You can
then save your Power BI Desktop file wherever you like, whether it be your local drive or to
the cloud.
Once you load data into Power BI Desktop you will enter into the Report View and you
will see the below screen.
The Visualizations and Fields pane can be collapsed by selecting the small arrow along
the edge, providing more space in the Report view to build cool visualizations.
Understanding Power BI Desktop User Interface (UI)/ Report View
1. Fields Pane
Fields Area will contain the tables with columns that are loaded into Power BI
Desktop.
2. Visualizations pane
The Visualizations pane will contain list of visualizations available in Power BI.
And you can also download a custom visual from the visuals gallery. Here you can change
visualizations, customize colors or axes, apply filters, drag fields, and more.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
3. Ribbon
It will contain the options that are associated with reports and visualizations.
4. Views
Report View
Data View
Relationships View
5. Pages Tab
The Pages tab area along the bottom, which lets you select or add a report
page.
6. Canvas
You can switch between Report View, Data View, and Relationship View by clicking on the
icons in the left hand navigation bar.
Once you’ve added some data to Power BI, you can add fields to a new visualization in the
canvas.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
To change the type of visualization, you can select it from the Visualizations group.
Be sure to experiment with different visualization types. It’s important your
visualization convey information in your data clearly.
A report will have at least one blank page to start. Pages appear in the navigator pane
just to the left of the canvas. You can add all sorts of visualizations to a page, but it's
important not to overdo it. Too many visualizations on a page will make it look busy and
difficult to find the right information. You can add new pages to your report, just click New
Page on the ribbon.
To delete a page, click the X on the page's tab at the bottom of the Report View.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Power BI Visual Interactions (Ad-hoc filtering and highlighting)
Power BI visuals are interactive with each other. Selecting an item in a visual will
effect on the display of another Visual. Sometimes this effect is highlighting items in another
Visuals, and sometimes filtering values in the other visuals. By default, all visuals in a report
page are interactive with each other. However, this interactivity can be controlled and
modified.
Default Behavior
All visuals in Power BI report page are interactive with each other. If you click on a
chart other charts will be highlighted or filtered.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
You will now see all other visuals in the page with two or three buttons on the top
right hand side corner of each. These are controls of interaction. Based on the requirement
we will select the interaction Type.
If you don’t want to filter or highlight the Visualization, select the no impact icon .
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Drillthrough in Power BI Desktop
With drillthrough in Power BI Desktop, you can create a page in your report that
focuses on a specific entity - such as a supplier, customer, or manufacturer. Users can right-
click on a data point in other report pages and drillthrough to the focused page to get details
that are filtered to that context.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Using drillthrough
To use drillthrough, create a report page that has visuals you'd like to see for the type
of entity on which you'll provide drillthrough.
For example, if you're interested in providing drillthrough for manufacturers, you
might create a drillthrough page with visuals that show total sales, total units shipped, sales
by category, sales by region, and so on. That way, when you drillthrough to that page, the
visuals will be specific to the manufacturer you selected.
Then, on that drillthrough page, in the Fields section of Visualizations pane, drag the
field about which you want to drillthrough into the Drillthrough filters well.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When you add a field to the Drillthrough filters well, Power BI Desktop automatically
creates a back button visual. That visual becomes a button in published reports, and lets
users who are consuming your report in the Power BI service easily get back to the report
page from which they came (the page from which they selected to drillthrough).
Filters in Power BI
Data filtering will involve taking out information that is useless to a reader or
information that can be confusing. Generated reports and query results from database tools
often result in large and complex data sets. Redundant or impartial pieces of data can
confuse a user. Filtering data can also make results more efficient.
Whether you're using Desktop or Power BI service, the Filters pane displays along the
right side of the report canvas.
There are four types of filters
Visual Level Filters
Page Level Filters
Report Level Filters
Drillthrough Filters
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Report Level Filters
These filters work on the entire report, filtering all pages and visualizations included in the
report.
Drillthrough filter
Drillthrough filter applies to a single entity in a report.
In above filters you will see the below filter Types based on requirement we will use any of
these types.
Basic Filtering
Advanced Filtering
Top N
Relative Date Filtering
If no visual is selected in the canvas, then the Filters pane displays just the filters that
apply to the entire report page or entire report, and any drillthrough filters (if any have been
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
set). In the example below, no visual is selected and there is no page level or drillthrough
filters but there is a report level filter.
If a visual is selected in the canvas, you will also see the filters that apply to just that
visual.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
To display options for a particular filter, select the down arrow next to the filter
name. In the example below, the report level filter is set to 2013 and 2014. And this is an
example of basic filtering. To display the advanced options, select Advanced Filtering.
Clear a filter
In either advanced or basic filtering mode, select the eraser icon to clear the
filter.
Add a filter
In Desktop and in Power BI service Editing view, add a filter to a visual, page,
drillthrough, or report by selecting a field from the Fields pane and dragging it into the
appropriate filter well, where you see the words Drag fields here. Once a field has been
added as a filter, fine-tune it using the Basic filtering and Advanced filtering controls
(described below).
Dragging a new field into the Visual level filter area does not add that field to the
visual, but it does allow you to filter the visual with this new field.
All the fields that are used to create a visualization are also available as filters. First,
select a visual to make it active. The fields that are being used in the visual are listed in the
Visualizations pane and in the Filters pane under the Visual level filters heading.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Advanced mode
Select Advanced Filtering to switch to advanced mode. Use the dropdown controls and
text boxes to identify which fields to include. By choosing between And and Or, you can build
complex filter expressions. Select the Apply Filter button when you've set the values you
want.
By choosing between And and Or, you can build complex filter expressions. Select the
Apply Filter button when you've set the values you want.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Types of filters: date and time
List mode
If the values are finite, selecting the field name displays a list. See Text field filters >
List mode above for help using checkboxes.
Advanced mode
If the field values represent date or time, you can specify a start/end time when using
Date/Time filters.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Grouping and Binning
When Power BI Desktop creates visuals, it aggregates your data into chunks (or groups)
based on values found in the underlying data. Often that's fine, but there may be times when
you want to refine how those chunks are presented. For example, you might want to place
three categories of products in one larger category (one group). Or, you might want to see
sales figures put into bin-sizes.
In Power BI Desktop, you can Group data points to help you more clearly view,
analyze, and explore data and trends in your visuals. You can also define the Bin size, often
called binning, to put values into equally sized groups that better enable you to visualized
data in ways that are meaningful.
Using grouping
To use grouping, select two or more elements on a visual by using Ctrl+click to multi-
select elements. Then, right-click one of the multi-select elements and select Group from the
menu that appears.
Once created, the group is added to the Legend bucket for the visual and it also
appears in the Fields list.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Once you have a group, you can easily edit the members of that group by right-clicking
the field from the Legend bucket, or from the Fields list, and selecting Edit Groups.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
In the Groups window that appears, you can create new groups or modify existing
groups. You can also rename any group by double-clicking on the group title in the Groups and
members box and typing a new name.
There are all sorts of things you can do with groups like you can add items from the
ungrouped values list into a new group or into one of the existing groups. To create a new
group, select two or more items (using Ctrl+click) from the ungrouped values box, and then
click the Group button below that box.
You can add an ungrouped value into an existing group, just select the ungrouped
value, then select the existing group to which you want to add it, and click the Group button.
To remove an item from a group, select it from the Groups and members box and then click
Ungroup. You can also select whether ungrouped categories should be placed into the Other
group, or should remain ungrouped.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Note
You can create groups for any field in the Fields well, without having to multi-select
from an existing visual. Just right-click the field and select New Group from the menu that
appears.
You can also create New Group and Edit Existing Groups from the Ribbon under
Modeling Tab as shown below.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Using binning
You can set the bin size for numerical and time fields in Power BI Desktop. You can use
binning to right-size the data that Power BI Desktop displays.
To apply a bin size, right-click a Field and select New Group.
From the Groups window, set the Bin size to the size you want.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When you select OK, you'll notice that a new field appears in the Fields pane with
(bins) appended. You can then drag that field onto the canvas to use the bin size in a visual.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Creating Bins on Number Column
We have two columns Order Date and Ship Date, from those columns get the number
of days taken for delivering the order using the below DAX formula by creating a New Column.
Give the column Name as Delivered Days. In his column we will create the Bins to see how it
works.
DATEDIFF(Orders[Order Date],Orders[Ship Date],DAY)
Practice
Create a visualization which show Sales by Sub-Category by Grouping Accessories,
Appliances and Art into one group and all other Sub-Categories into another Group.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Create a Visualization which shows sales by “No of Days for Delivery” by creating bin
on “No of Days for Delivery” field with bin size 2.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Sorting Data in Visuals in Power BI Desktop
In Power BI Desktop and the Power BI service, you can change how a visual look by
sorting it by different data fields. By changing how you sort a visual, you can highlight the
information you want to convey, and ensure the visual reflects that trend (or emphasis).
Whether you're using numeric data (such as sales figures) or text data (such as state
names), you can sort your visualizations as desired, and make them look like you want them
to. Power BI provides lots of flexibility for sorting, and quick menus for you to use. On any
visual, select the ellipses menu (...) and then select the field by which you want to sort, as
shown in the following image.
The below visualization shows Sales and Profit by Sub-Category. Here's the
visualization as it looks before we do any further sorting.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
The visual is currently sorted by Sales - we can tell that by matching the color of the
descending bars to the legend, but there's a better way to determine the current sort column,
the ellipses menu (...) in the upper right corner of the visual. When we select the ellipses, we
see the following.
The current sorting field is Sales, indicated by the facts that Sort by Sales has a yellow
bar.
The current sorting direction is largest to smallest, as shown by the little icon Z/A and
a down arrow, indicated by the facts that Z/A Sort Descending has a yellow bar.
In the above Image you noticed the yellow bar beside Sort by Sales in the More
Options menu, which indicates that the visual is sorted by the Sales column. Sorting by
another column is easy - just select the ellipses to show the ellipsis menu, and then select
another column.
In the following image, we selected Profit as the column by which we want to sort.
Here's what it looks like after we select Sort by Profit.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Notice how the visual has changed. The values now are ordered from highest Profit
value, in this visual “Copiers”, down to “Tables” which has the lowest and Negative Value of
Profit.
When “Z/A Sort Descending”, it means the visual is being sorted by the selected
column in order of greatest value to smallest value. Want to change that? No problem - just
select “A/Z Sort Ascending”, it means the visual is being sorted by the selected column in
order of smallest to greatest value.
NOTE
Not all visuals can be sorted. For example, the following visuals cannot be sorted:
Treemap, Map, Filled Map, Scatter, Gauge, Card, Multi Row Card, and Waterfall.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Sort using the Sort by Column button
You can even sort the Visualization using the column that is not used in the
Visualization using Sort by Column option in The Ribbon under Modeling Tab.
Use the below DAX formulas to create Two New Columns for Getting Month_Name and
Month_Number from “Order Date” Column. Or else add those two columns in Power Query.
MonthName = FORMAT (Orders [Order Date], "MMMM")
MonthNo = MONTH (Orders [Order Date])
There's another way to sort your data, and that's by using the Sort by Column button in
the Modeling ribbon.
This approach to sorting requires that you select a column from the Fields pane, and
then select the Sort by Column button to choose how (by which column) you want to sort your
visual. You have to select the column (field) you want to sort from the Fields pane in order to
enable the Sort by Column button - otherwise the button is inactive.
Let's look at a common example: you have data from each month of the year, and you
want to sort it based on chronological order. The following steps show you how.
First, notice that when the visual is selected but no column is selected in the Fields
pane, the Sort by Column button is inactive (grayed out).
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When we select the column by which we want to sort, in the Fields pane, the Sort by
Column button becomes active.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Now, with the visual selected, we can select MonthOfYear, instead of the default
(MonthName), and the visual now sorts in the order we want: by the month of the year.
And that's it. Remember that you must select a column in the Fields pane for the Sort
by Column button to become active.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Hierarchies and Drill-Down in Power BI
Hierarchy
The ordering and grouping of Attributes or Dimensions called as Hierarchy.
Hierarchy is an ordered sequence of dimensions, which is very helpful for analysis of data.
Hierarchy is a relationship, where one of the items is "detail" of another one. Like Continent /
country / State /city, Year / month / day.
Examples
Time Hierarchy
Year Quarter Month Day
Geographic Location Hierarchy
Continent Country State City
Product Hierarchy
Category Sub-Category Product Name
Instead of creating the visualizations for each dimension individually we will create a
Hierarchy for Related Dimensions (Category Sub-Category Product Name) and will use
that hierarchy in the visualizations.
Power BI Hierarchies provides you the drill down action to the Power BI Visualizations.
When a visual has a Hierarchy, it enables the ability to drill down for additional relevant
details.
One very common hierarchy is a date hierarchy, which is used to show data summarized by
year, then all the values for the quarters, then the values for three months in each quarter
and each month which at the lowest level includes all the values for dates.
There are other hierarchies which may also exist in data, such as Geographic Location
Hierarchy, Product Hierarchy.
Geographic Location Hierarchy contains Continent which includes Countries which include
states or provinces which include cities.
Product Hierarchy Contains Categories which include Sub-Categories which include Product
Names.
Creating Hierarchy in Power BI
Before we build a hierarchy, we’ll need to know the levels that comprise the hierarchy. In our
example, the levels are Category Sub-Category Product Name
There is couple of ways to create a hierarchy in power bi.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
First approach to Create Hierarchy in Power BI
After we know the hierarchy levels, we’ll use simple drag/drop techniques to create
the hierarchy. Since Category is our first level in the hierarchy, let’s look for Sub-Category
and place it right on top of Category. Notice that there is a new item was created called
“Category Hierarchy”.
Finally, we’ll drag and drop Product Name on the Category Hierarchy we just created
and rename Category Hierarchy to Product Hierarchy by right-clicking Category Hierarchy and
selecting “Rename”.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Second Approach to Create Hierarchy in Power BI
Right clicking on the ellipse next to any field let’s say Category in a table, displays a
context menu, and the second item on the context menu is New Hierarchy.
When you select this, a new hierarchy will be created with that field name suffixing
with Hierarchy (Category Hierarchy).
If you want to add other fields to the above hierarchy (Category Hierarchy), select the
field and right click on it and select add to the hierarchy.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Change Hierarchy Levels in Power BI
Please be careful while configuring the hierarchy levels. For instance, if you have the
Sub-Category column above the Category, Then Level 1 will be Sub-Category, level 2 will be
Category.
Please select the field that you want to change the position or level. Next, right-click
on it and select the Move Up option (or move down) from the context menu. Alternatively,
you drag and drop the field at the required position.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
2. If your data has multiple levels then these buttons will be displayed
in the visualization.
3. Right-click on the report will show the context menu. You can use this menu to select
the levels.
NOTE: There is a difference between Shown Next Level, and Drill Down. Show Next level will
show you the complete data in the next level but the Drill down option will show you the
selected data.
Drilling filters other visuals
As you work in Drill mode, you get to decide how drill down and expanding impacts the
other visualizations on the page.
By default, drilling will filter other visuals in a report. But this feature can be disabled in
Power BI Desktop and Power BI service if you needed.
In Desktop, select the Format tab and select the checkbox for Drilling filters other visuals.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Date Hierarchy in Power BI
As with most data analysis tasks, working with time can be the most challenging detail
to get correct. Power BI has built-in functionality that will display a drillable hierarchy of
year, quarter, month and days when a column, formatted as a date, is dropped onto
visualization.
If you are creating a table and drag a field, formatted as a date, you do not get a
single date but the hierarchy as pictured below. This creates a built-in way to drill down
through the year on various graphs and tables. On visualization, this allows you to provide
different views of your data over time. You can also remove a level from the list by selecting
the ‘X’ next to the level depending on your needs.
However, this behavior is the default. If you want to show the actual date field, you
have to click on the down arrow next to the date field as shown below. This allows changing
the selection from the Date Hierarchy to the field that contains your Date Values.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Considerations
If adding a date field to visualization does not create a hierarchy, it may be that the
“Date” field is not actually saved as a date. If you have owned the data set, open it in Data
view in Power BI Desktop, select the column that contains the date, and in the Modeling tab
change the Data Type to Date or Date/Time as shown in the picture below. If the report has
been shared with you, contact the owner to request the change.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Visualizing Data
Visualizing the data means presnting the data in graphical or pictorial format
format. Visualizing data is one of the core parts of Power BI - a basic building block as we
defined it earlier in this course.
Why Visualizations
Creating visuals is the easiest way to find and share your insights.
You can get the insights esaily when you present in the form of visuals rather than
text table. In the below figure you can easily identify the highest sales produced
product in the visual rather then text table.
Once you have connected to the data sources and created a data model, the next step
is to create visualizations. One of the things that set Power BI apart from other visualization
tools is that you can create interactive visualizations—that is, visuals, that can interact with
each other by cross-filtering the underlying data.
Up to this point, you have spent some time importing data and modeling it to your
specifications. Now, we will begin to visualize the data in efficient and effective ways. The
most common association with Power BI for consumers is the ability to create very impactful
visualizations of data, and there are many options available to do this. Here, we will look at
all the various options that are available to you within the Power BI Desktop application.
Additionally, we will take a brief glimpse at the additional visualization options that are
available through the Custom Visuals Marketplace. In this section we will discuss about below
topics.
Data visualization basics
Visuals for filtering
Visualizing categorical data
Visualizing trend data
Visualizing KPI data
Visualizing tabular data
Visualizing geographical data
Leveraging Power BI custom visuals
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
There are 30 readily available visuals in the Power BI Desktop application. We will be
exploring most of them and how they best work with certain types of data sets.
As soon as you launch the Power BI desktop application and close out of the initial
splash screen, you will find yourself in the Report View, which is where we will stay for the
duration of this chapter. In the previous chapter, you explored the Relationship view as well
as the Data view, but these areas are not necessary for the visualization work we will be
doing. There are many items of interest in this initial Report view area that we need to
discuss so that we can work efficiently.
1. Report view This is the button that will place us in the Report canvas and allow us to
create visuals.
2. Visuals area / Visualizations Pane This is where we can choose which visual, we
would like to use. Once custom visuals are added, they will appear here as well.
3. Field area / Fields Well This area will change depending on the visual but it is where
we place the fields we will use within the selected visual.
4. Field pane These are all the available fields we have to choose from to add to our
visuals.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
5. Format area Here is where we can decide on many things specific to either the entire
report page or the selected visual, such as text size, font style, titles, and so on.
6. Filters area This is where we can apply filters of various scopes
Page-level filters Any filters applied here will affect every single visual on the
selected page.
Drillthrough filters This option allows users to pass a filter value from a
different report page to this one.
Report-level filters Filters applied here will affect every single visual for the
entire Power BI report.
Visual-level filters This category will only appear when you have a visual
selected, and the applied filters will only affect the selected visual.
7. Custom visuals By selecting this button, you will have a menu appear that has access
to all the custom visuals from the Microsoft store. You can then add whichever visual you
would like to the Visuals area.
8. Report page Here is where you can select which report page you would like to work
with. Each page has a limited work area where we can use to create visuals, so it is
common to have more than one page in a Power BI report.
9. Add Report page By selecting this symbol, you can add a new report page to add
more area in which we can add visuals.
Now that we have familiarized ourselves with the Report page features and layout, it’s
time to start visualizing!
Filtering the data that users will see within a Power BI report is the most effective way
to answer very specific questions about that data, and there are many ways to accomplish
this. One of Power BI's best features is its default capability to allow users to interact with a
visual, which will then apply that as a filter to the rest of the visuals on that page, and this is
known as interactive filtering. This behavior really puts the power into the user’s hands, and
they can decide how they want to filter the visuals. This now makes a report so much more
robust because it can answer so many more questions about the data. Along with this
functionality, we, report developers, can add more explicit forms of filtering using the Slicer
visual that is available to us in the visuals area. This allows us to choose a very specific field
from our data, that we know our end users will want to manipulate to see that data in various
different states. So now, let’s dive in and get a better understanding on these two filtering
options, as they will most definitely be elements we will see in our finished reports.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Slicer Visualization
Slicers are one of the most powerful types of visualizations, particularly as part of a
busy report. A slicer is an on-canvas visual filter in Power BI Desktop that lets anyone looking
at a report segment the data by a particular value, such as by year or by geographical
location.
Slicer Visualization in Power BI is used to filter the results of visuals on your report
page. It is used as a user level filter. Users will interact with report using Slicers. And with
slicers, you can easily adjust the filter that's applied by interacting with the slicer itself. You
can also specify options for how your slicer appears, and how you interact with it.
A slicer is a list of values from which one, multiple or all values can be selected to
filter the data shown in report.
When you select an item in the slicer, only that item corresponding information will be
shown and the rest of the data gets filtered out. For instance, take your entire sales data.
You can set up slicers to look at sales by Country, Category, Subcategory and Product.
To add a slicer to your report, select Slicer from the Visualizations pane.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Drag the field by which you want to slice and drop it top of the slicer placeholder. The
visualization turns into a list of elements with checkboxes. These elements are your filters -
select the box next to one to segment and all other visualizations on the same report page
are filtered, or sliced, by your selection.
There are a few different options available to format your slicer. You can set it to
accept multiple inputs at once, or toggle Single Select mode to use one at a time. You can
also add a Select All option to your slicer elements, which is helpful when you have a
particularly long list. Change the orientation of your slicer from the vertical default to
horizontal, and it becomes a selection bar rather than a checklist.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
A slicer can be shown from one of various types below based on data type of the
column used in slicer.
List
Dropdown
Between
Before
After
Relative
Less than or equal to
Greater than or equal to
Display commonly-used or important filters on the report canvas for easier access.
Make it easier to see the current filtered state without having to open a drop-down
list.
Filter by columns that are unneeded and hidden in the data tables.
Create more focused reports by putting slicers next to important visuals.
In Power BI Desktop you can synchronize slicers across multiple report pages. To
synchronize slicers, in the View Tab in the ribbon, select Sync slicers. When you synchronize
slicers, the Sync Slicers pane appears, as shown in the following image.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Hierarchy Slicer / A Custom Visualization in Power BI
The Hierarchy Slicer visual is a great way to filter your data within a hierarchical view.
The hierarchy slicer for Power BI provides the opportunity to simple select multiple members
of different levels of a hierarchy as selection. The slicer can be used with an existing
hierarchy or a manual created hierarchy.
Advantages of Hierarchy Slicer
Hierarchy Slicer lets you expand and dig into each level of your hierarchy data.
Hierarchy Slicer allows you to display a measure value at the lowest level.
Hierarchy Slicer replaces the idea using multiple regular slicers to represent what the
Hierarchy Slicer does.
In this Hierarchy Slicer we’re showing the ability to filter down a product hierarchy.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Visualizing Categorical Data
The following visuals are best for displaying data values across categories. In these
visuals, we will be displaying Bars, Columns, and other visual elements, which will be
proportional to the data value. All of the visuals allow for interactive filtering and the use of
drilldowns. We will focus on how to understand and configure the following visuals.
Value You can use one or more numerical fields. If you use a legend or color saturation,
you can only put one field into this field well.
There are some situations where the Bar chart will better display data, and the same
thing can be said of the Column chart. The biggest limitation for the Column chart would be
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
the limited space on the x-axis where the category would go. So, if you have a lot of data
labels or if they are very long, you may find that the Bar chart is the better option. An
example where you might choose the Column chart over the Bar chart is if your data set
contains negative values. In a Bar chart, the negative values will show on the left side while
in a Column chart they will display on the bottom. Users generally associate negative values
with a downward direction.
Both the Pie chart and Donut chart are meant to visualize a particular section to the
whole, rather than comparing individual values to each other. The only difference between
the two is that the Donut chart has a hole in the middle, which could allow for some sort of
label. Both of these visuals can be very effective in allowing interactive filtering, but if there
are too many categories it can become difficult to read and interpret. Pie Charts are very
useful to visualize the High level data. If we have many categories where we need to see a
particular section to the whole, then go with treemaps.
Values You may use one or more numerical fields here. If you use Details, you are limited
to one field only.
Treemap
Treemaps display hierarchical data as a set of nested rectangles. Each level of the
hierarchy is represented by a colored rectangle (often called a "branch") containing other
rectangles ("leaves"). The space inside each rectangle is allocated based on the quantitative
value being measured, with the rectangles arranged in size from top left (largest) to bottom
right (smallest).
Treemap charts can be thought of as rectangular pie charts because they also show
the relationship of the parts to the whole. You can nest rectangles to further divide the
whole. There are five field wells in Treemap.
Values You may use one or more numerical fields here. If you use Details, you are limited
to one field only.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Color saturation You may use a numerical field here unless you are using Details.
A scatter chart always has two value axes to show one set of numerical data along a
horizontal axis and another set of numerical values along a vertical axis. The chart displays
points at the intersection of an x and y numerical value, combining these values into single
data points. These data points may be distributed evenly or unevenly across the horizontal
axis, depending on the data.
A bubble chart replaces the data points with bubbles, with the bubble size representing an
additional dimension of the data.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Column or Bar chart can be easily used for showing a single measure’s insight across a
category. Mixed charts such as Line and Column chart can be used for showing two measure
and comparing their values across a set of categories. However, there are some charts that
can be used to show values of three measures, such as Scatter Chart. Scatter chart not only
shows values of three measure across different categories, it also has a special Play axis that
helps you to tell the story behind the data.
Scatter chart is a built-in chart in Power BI that you can show up to three measure
with a categorization in it. Three measures can be visualized in position of X axis, Y axis, and
size of bubbles for scatter chart. You can also set up a date field in play axis, and then
scatter chart will animate how measure values are compared to each other in each point of a
time.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Visualizing Trend Data
When we use the term Trend Data, we are talking about displaying and comparing
values over time. Power BI gives us many options in this category, each with their own focus.
The idea for each of the visuals, though, is to draw attention to the total value across a
length of time.
Line and Area Charts (Line chart, Area chart, Stacked area chart)
Combo Charts (Line and Stacked column chart, Line and Clustered column chart)
Ribbon Charts
Waterfall and Funnel Charts
Line chart
Area chart
Stacked area chart
The Line chart is the most basic of our options when it comes to looking at data over time.
Line charts are best used when you are comparing values across time. The Area chart and
Stacked Area chart are based on the line chart; the difference is that the area between the
axis and the line is filled in with colors to show volume. Because of this, we will focus on the
Line chart for our example. Since we have a very nice Date hierarchy, we will use this
alongside a couple of measures to see trending.
All three charts have the following field wells
Axis One or more categorical columns.
Legend You can place one categorical column.
Values One or more numerical fields can be used; if you use a legend, you can only use one
field in this well.
Tooltips One or more fields can be used.
Single Line Chart
Put Date/Time value to the Axis field well, this is the X-axis of the line chart.
Put data field that you want to show (here Sales) in the Value field well.
The line chart is basically done. Now it is up to you to customize it as per your need.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Area Chart
Area charts are very similar to line charts. The basic area chart is based on the line
chart. The area between axis and line is filled with colors to indicate volume. They both show
quantitative data with a time period on the x-axis.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Combo charts
There are two combo charts in Power BI
As the name states, Combo charts combine the Line chart and Column chart together in
one visual. Users can choose to have either the Stack Column format or the Clustered Column
format. By combining these two visuals together, we can make a very quick comparison of the
data. The main benefit of this type of chart is that we can have one or two Y axes. What this
means is that we can either display two measures that would have the same Y axis, something
like Total Sales and Profit. Or, we could show two measures that are based on completely
different values such as Order Quantity and Profit; let's use the two for our example.
For this example, we will be using the Line and Stacked Column Chart visual.
For the Shared Axis area, let's select the Date field (Order Date).
We will then select the Quantity field to populate the Column Values section.
Then select the Profit measure field to populate the Line Values section.
In this example, you can see that we have two Y axes; the left one relates to the
Quantity while the right one corresponds with our Profit measure.
By default, the column values appear on the left, and the line values appear on the
right.
Go ahead and expand the hierarchy two level; this will give us more data points to see
the trending between the two measures, as seen in the below Figure. From this visual,
it's fairly easy to validate that when we sell more items we make more profit.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When you have a line chart and a column chart with the same X axis.
To compare multiple measures with different value ranges.
To illustrate the correlation between two measures in one visualization.
To check whether one measure meet the target which is defined by another measure
To conserve canvas space.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Ribbon chart
The Ribbon chart is similar to a column chart, but it has ribbons between the bars to
highlight changes in the relative ranking of categorical items. The item with the highest value
will be displayed on top. You can use ribbon charts in Power BI to visualize data, and quickly
determine which category of data has the highest rank (largest value). Ribbon charts are
effective at showing rank change, with the highest range (value) always displayed on top for
each time period.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
The chart has four field wells
Axis One or more categorical columns.
Legend You may use one categorical column.
Value You can use one or more numerical fields in this well; if you use a legend, you can
use one field only.
Tooltips You may use one or more fields.
Waterfall Chart
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 changes.
The columns are color coded so you can quickly tell increases and decreases. The
initial and the final value columns often start on the horizontal axis, while the intermediate
values are floating columns. Because of this "look", waterfall charts are also called bridge
charts.
Example: Drag Order Date to Category field Well, Sales field to Y Axis field well and Category
fied to Breakdown field well as shown in the above visual. You can see Year wise sales and
contribution of each category for decay or growth of year wise sales.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When to use a waterfall chart
Waterfall charts are a great choice
When you have changes for the measure across time series or different
categories
To audit the major changes contributing to the total value
To plot your company's annual profit by showing various sources of revenue and
arrive at the total profit (or loss).
To illustrate the beginning and the ending headcount for your company in a
year
To visualize how much money, you make and spend each month, and the
running balance for your account.
Category Value
Site Users 1020
Enquiries 800
Demo Attended 200
Registered 150
Placed 100
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
The visual has four field wells
Group You can use one or more categorical columns here.
A funnel chart can be a proper choice for showing values by stages, for instance, by
lead generation stages. The visual can also be used for revealing bottlenecks in a process or
to track workflow.
In our example drag the Sub-category field to Group and Sales to Values.
The way we have set up this visual allows us to very easily identify which Sub-category make
the most Sales and which make the least, but this is something we can achieve with many
other visuals. What gives the Funnel Chart an edge is when we hover over one of the sections
within the funnel and note the items that appear within the Tooltip. You will see when we
hover over the section for Tables Subcategory that the tooltip lets us know how it compares
to the section directly above it, as well as how it compares to the highest section, which is
represented by the Phones.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Visualizing Tabular Data
We will see that there are many options within Power BI to visually represent data,
but sometimes our users may want to see and compare detailed data and exact values. In
these scenarios, by using the Table or Matrix visual ends up being our best choice. When
leveraging either of these two visuals, it is important to take advantage of the Format area to
ensure that users can easily interpret the detailed data that is being presented. One of the
best ways to bring attention to values of importance with these visuals is by using Conditional
Formatting. We will explore this option, as well as take advantage of the hierarchies to allow
for drill downs within the visuals.
The Table Visual
The table visual is perfect for looking at many values (measures) for a category. To
really make the table shine, we will also want to take advantage of the Conditional
Formatting option that is available to us.
In the below table visual we use multiple dimensions and measures also we formatted
the Profit column conditionally in such a way negative profits in Red color and Positive Profits
in Green Color.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Matrix Visualization
A Matrix is similar to a table, but it has different category headers on the columns and
rows. As with tables, numerical information will be automatically totaled along the bottom
and right side of the matrix.
Install R
Power BI Desktop does not include, deploy, or install the R engine. To run R scripts in
Power BI Desktop, you must separately install R on your local computer. You can download
and install R for free from the below links.
https://mran.revolutionanalytics.com/download
https://cran.r-project.org/bin/windows/base/
Enable R visuals
To enable R visuals, select File Options and settings Options and in the Options
page that appears, make sure your local R installation is specified in the R Scripting section of
the Options window, as shown in the following image. In the following image, the path local
installation of R is C:\Program Files\R\R-3.4.3 and that path is explicitly provided in the text
box. Make sure the path it displays properly reflects the local R installation you want Power BI
Desktop to use.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Once you specify your R installation, you’re ready to begin creating R visuals.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When you add an R visual to a report, Power BI Desktop does the following
Next, add fields you want to consume in your R script to the Values section in the
Fields well, just as you would with any other Power BI Desktop visual.
Now you can use the data you selected to create a plot.
As you select fields, the R script editor generates supporting R script binding code based on
your selections in the gray section along the top of the editor pane.
In the example shown in the following image, three fields were selected: Category, Sub-
Category, and Sales. As a result of those selections, the R script editor generated the
following binding code:
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
The generated dataframe is called a dataset, and you can access selected columns by their
respective names. For example, access the Category field by writing dataset$Category in your
R script. For fields with spaces or special characters, use single quotes (dataset$’Sub-
Category’).
With the dataframe automatically generated by the fields you selected, you’re ready to write
an R script those results in plotting to the R default device. When the script is complete,
select Run from the R script editor title bar (Run is on the right side of the title bar).
plot(dataset$State,dataset$Sales)
When you select Run, Power BI Desktop identifies the plot and presents it on the canvas.
Since the process is executed on your local R installation, make sure the required packages
are installed.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Power BI Service Introduction
Still now we created reports using the Power BI Desktop client. Now, it's time to share
those reports with your team, company, or customers using Power BI Service.
Power BI Desktop Solution can be published to Power BI Service for Admin related
activities.
The Reports Developed in Power BI Desktop is published to Power BI Service for
Dashboard development.
You can build Reports directly by selecting Data Sources on Power BI Service as well.
From Power BI Desktop you can connect Live to Power BI datasets that are published
to Power BI Service to create New Reports.
The Datasets prepared in Power BI Desktop published to Power BI Service and can be
scheduled to refresh, if you need any additional Reports with this Datasets you can
generate and can be used in Dashboards.
With Power BI Service you can manage the Reports and Dashboards; you can share the
Reports and Dashboards with the end users or Business users.
Reports or Dashboards shared from Power BI Service can be accessed anywhere from
the world.
You can view the Reports or Dashboards that are shared with you with the help of web
browsers or Mobile Application (Power BI Mobile).
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Creating Power BI Service Account
Scroll Down; go to Cloud collaboration and sharing TRY FREE. Sign Up with your work
email address.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Deploying / Publishing Reports to the Power BI service
There are numerous ways to publish a report to the Power BI Service, but the easiest way
is by using the Power BI desktop. To do this, you'll need to simply click the Publish button in
the desktop application, as shown in the following screenshot. If you have not previously
signed in with your Power BI Service account, you will be prompted to create one or sign in
with an existing account.
You'll then be asked which workspace you want to deploy to. A Workspace is an area in
the Power BI service that is much like a folder, where you can bundle your reports, datasets,
and dashboards. You can also assign security to the workspace and not have to worry about
securing each item. Most importantly, it allows for team development of a Power BI solution,
where you can have multiple authors on a solution.
At this point, select the My Workspace item, which will send the report and its data to
your personal workspace. The report will then deploy to the Power BI service. The amount of
time this takes will depend on how large your dataset is.
If you open the report, Power BI Service will launch and show you the same report that
you were viewing in the desktop in a web browser. You'll also be able to immediately see the
report in the Power BI mobile app from your Android or iPhone.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Other way to publish data to PBI Service / Get the Report to PBI Service
https://app.powerbi.com
Open Workspace where you need the Report to be published or imported. At this point, select
the My Workspace item, which will send the report and its data to your personal workspace.
Select Get Data Under Create new content and Under Files Select Get
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Furthermore, if the workspace you are publishing to already contains a dataset with the
same name, you will be asked if you want to replace it. By default, the report will be
published to My Workspace.
Once you are done, you can go to Power BI service and see the report. Now you can see
the Dataset used for that report Development in the Datasets Section and Report you
Published in Reports Section along with an Empty Dashboad in Dashboards Section.
My Workspace Tabs / APP WORKSPACES TAB
Power BI Service My Workspace / APP WORKSPACES has Four Key Areas you can interact with
DATASETS
This is the data that you have built in the Power BI desktop. When you click the datasets,
you can also build new reports from those datasets in Power BI Service. You can also connect
to this Dataset Live from Power BI Desktop if you have access to that workspace to build the
New Reports using Power BI Desktop using this dataset.
WORKBOOKS
You can upload Excel workbooks into this area. These Excel workbooks can be used as a
dataset or can form pieces of the workbook that can be pinned to a dashboard.
REPORTS
This refers to what you have built in the Power BI desktop. These reports can be
explored, modified, or downloaded in this section.
DASHBOARDS
You can pin the best elements from multiple reports into a unified set of dashboards.
These dashboards are the first thing most of your casual users will interact with.
Working with Datasets
The DATASETS area of Power BI holds the data that makes up your reports. In the dataset
when you select Create Report Option, the designer opens to build reports from the dataset.
The designer can be used to do the following things.
Create more Quick Insights
Create new reports
Refresh or schedule refreshes
Download the Power BI Desktop file (.pbix)
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When you start with a dataset, users can create new reports from your data, even when
accessing it through the web. The entire user interface will feel nearly identical to Power BI
Desktop, but you will be lacking the ability to modify the model, query, and relationships.
The best part of building reports here is that you have a central dataset that IT can own,
modify, and make human-readable so that the entire organization can build reports off of it.
Power BI Datasets Live Connection
You can establish connection to a shared dataset in the Power BI service, and create
many different reports from the same dataset. This means you can create your perfect data
model in Power BI Desktop, publish it to the Power BI service, then you and others can create
multiple different reports (in separate. pbix files) from that same, common data model. This
feature is called Power BI datasets Live connection.
To create Shared dataset, you need to create a dataset and report in Desktop and
publish it in a workspace which is common to all. Example in a project if 4 Members need to
build a Reports on the shared dataset, create a App Workspace specific to this project and
provide edit permissions to the 4 Members. Now publish the Dataset from Desktop to this
Workspace.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Establish a Power BI datasets live connection to the published dataset.
If you’re not signed in to Power BI, you’ll be prompted to do so. Once logged in, you’re
presented with a window that shows which workspaces you’re a member of, and you can
select which workspace contains the dataset to which you want to establish a Power BI
datasets live connection. Here I will connect to ProductDetails.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Click on load and the dataset will be loaded as shown below and you can create the reports
and publish it.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
The visualizations you see on the dashboard are called tiles and are pinned to the
dashboard from reports.
Once you have deployed your datasets and are using them in reports, you're ready to
bring together the many report elements into a single dashboard. Often, your management
team is going to want to have a unified executive dashboard that combines elements such as
your sales numbers, bank balances, customer satisfaction scores, and more into a single
dashboard. The visualizations on a dashboard come from reports and each report is based on
one dataset. In fact, one way to think of a dashboard is as an entryway into the underlying
reports and datasets. The amazing thing about dashboards in Power BI is that data can be
actionable and reacted too quickly. You can click on any dashboard element and be
immediately taken to the report that makes up that number.
Advantages of dashboards
Dashboards are a wonderful way to monitor your business, to look for answers, and to
see all of your most-important metrics at a glance. The visualizations on a dashboard may
come from one underlying dataset or many, and from one underlying report or many. A
dashboard combines on-premises and cloud-born data, providing a consolidated view
regardless of where the data lives.
A dashboard isn't just a pretty picture, it's highly interactive and highly customizable and
the tiles update as the underlying data changes.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Creating dashboard and Add Text and Images
To create dashboard, start by opening a report that has some interesting data. On each of
the charts, tiles, and other elements, you'll see a pin icon in the top right of that object.
After you click on the pin, it will ask you what dashboard you wish to pin that report element
to. You can, at that point, select a new dashboard to create or choose an existing dashboard
to add the element to, as shown in the following screenshot. This is what makes Power BI so
magical—you're able to append data from your accounting department next to data from your
sales and customer service teams, giving your executives one place to look.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
There are several ways in which you can add more tiles to a dashboard. When you are in
a report and hover over a visual, you will see a pin icon.
Another way to add a tile is to click on the Add Tile button when you are in a dashboard,
this gives you the following options
Web Content
Image
Text Box
Video
Custom Streaming Data
While you can pin an image visual from a Power BI report, the Add Tile option allows you
to pin an image that is not contained in any report. When you select Image and click Next,
you will be able to specify the URL of an image. Optionally, you can specify a title and
subtitle. Clicking Apply will pin the image to your dashboard.
To add text to your dashboard, you can either pin an existing text visual from a report or
choose the Text Box option in the Add Tile menu in a dashboard. If you choose the latter, you
will be presented with a text editor, where you can use rich text formatting and create
hyperlinks.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Access on-premises data from Power BI Service – Data Gateway
What are Power BI data gateways?
When you create your reports based on on-premises data and publish them online or
Power BI Service, to refresh your datasets, you will need a way to access your on-premises
data sources. This can be achieved with a data gateway.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Using a gateway
There are four main steps for using a gateway
Install the gateway on a local computer, using the appropriate mode.
Add users to the gateway and data sources, so they can access on-premises data
sources.
Connect to data sources, so they can be used in reports and dashboards.
Refresh on-premises data, so Power BI reports are up to date.
How gateways work
The gateway you install runs as a Windows service, On-premises data gateway. This
local service is registered with the Gateway Cloud Service through Azure Service Bus. The
following diagram shows the flow between on-premises data and the cloud services that use
the gateway.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Queries and data flow
A query is created by the cloud service with the encrypted credentials for the on-
premises data source. It's then sent to a queue for the gateway to process.
The gateway cloud service analyzes the query and pushes the request to the Azure
Service Bus.
The on-premises data gateway polls the Azure Service Bus for pending requests.
The gateway gets the query, decrypts the credentials, and connects to the data
sources with those credentials.
The gateway sends the query to the data source for execution.
The results are sent from the data source, back to the gateway, and then onto the
cloud service and your server.
Downloading and Installing a data gateway for Power BI
Download Data Gateway
To install a gateway, you need to sign into Power BI Service and click on the Download
button in the top-left corner of the screen, then click Data Gateway.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Now you are seeing Gateway Usage and some recommendations. Select Next
Types of gateways
The Power BI Gateway can be installed in two modes
On-premises data gateway
This gateway can be used by multiple users that have access to the server onto which
you install the gateway. It can be used for both scheduling refresh and live queries in Power
BI. You can also use it for PowerApps, Logic Apps, and Microsoft Flow. This gateway is well-
suited to more complex scenarios with multiple people accessing multiple data sources.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
On-premises data gateway (personal mode)
Only you can use this, and you can use it only for scheduling refresh in Power BI. The
Live Connection connectivity mode, PowerApps, Logic Apps, Microsoft Flow are not
supported. This gateway is well-suited to scenarios where you’re the only person who creates
reports, and you don't need to share the data sources with others.
In general, a data gateway should be installed on a machine that is always on and
connected to the Internet, because a gateway cannot access on-premises data sources from a
machine that is powered off. You can install up to one gateway in each mode on the same
computer, and you can manage multiple gateways from the same interface on Power BI
Service. Click Next.
Keep the default install path, and accept the terms Install.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Click on Yes to make changes to the system.
Enter the account you use to sign in to Power BI Select Sign in.
The gateway is associated with your Power BI account, and you manage gateways from
within the Power BI service. You're now signed in to your account.
Select Register a new gateway on this computer Next.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Enter a name for the gateway (must be unique across the tenant) and a recovery key.
You need this key if you ever want to recover or move your gateway. Select Configure.
Review the information in the final window. Notice that the gateway is available for Power
BI. Click on Close.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Select the Data Source Type.
Enter information for the data source. For this example, it's Server, Database, and
other information. Once you choose the SQL Server data source type, you will need to specify
the server and database name, authentication method, username, and password. In the
advanced settings, you have an option to use SSO via Kerberos for DirectQuery queries and
choose a privacy level setting for this data source. In our case, we can specify just the server
and database name, authentication method and credentials, leaving the advanced settings as-
is. Note that you cannot leave the database name blank, even though you can connect to a
server without specifying a database in Power BI Desktop. Select Add.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
You see Connection Successful if the process succeeds as shown in below image.
You can now use this data source to include data from SQL Server in your Power BI dashboards
and reports.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Manage users and administrators
Add and remove administrators
If needed, you can enable others to administer the gateway in the Administrators Tab.
Note that this does not automatically grant access to each data source in the gateway, you
will need to add Users to each data source or he himself can add to that data source as he is
now administrator for that data gateway. If you are the administrator for the data gateway,
then you can add new Data Sources to data gateway and can perform refresh and scheduled
refresh on the data sources.
On the Administrators tab for the gateway, add and remove users that can administer the
gateway.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Remember that you need to add users to each data source to which you want to grant access.
Each data source has a separate list of users, and you must add users to each data source
separately.
Remove users from a data source
On the Users tab for the data source, you can remove users that use this data source.
As shown in the above image select the user to remove and press Remove Button that is there
in the bottom.
Remove a gateway
You can remove a gateway if you're no longer using it. But be aware that removing a
gateway deletes all the data sources connections under it, and if the data source is extract
then you are unable to refresh or schedule refresh. If your data source is live you cannot see
the data in visuals. This in turn breaks any dashboards and reports that rely on those data
sources.
In the upper-right corner of the Power BI service, select the gear icon Manage gateways.
Select the gateway Open Menu by selecting the … beside the gateway name Remove
www.abtrainings.com
Collaborate in your Power BI using App Workspace
About App Workspaces
App workspaces are where teams collaborate on content. Power BI content is made up of
dashboards, reports, workbooks, and datasets. And each piece of content is associated with a
workspace. My workspace is where you create and manage content you own. Shared with me
is where read-only content that colleagues have shared with you is stored.
Workspaces are areas where groups of users can collaborate with datasets, reports, and
dashboards.
When you open Power BI for the first time, you'll have one top-level workspace named My
Workspace. You can create and add new workspaces, and those will be organized as APP
WORKSPACES.
You can create a workspace if you have a pro license of the Power BI service. This is the
main way that your BI developers will be able to co-develop the same sets of data and reports.
Typically, you'll create a workspace for each department in your company for the teams to
store their items and data.
As the creator of a group, you are automatically an admin. As admin, you can add and
delete members, and make other members admins. All admins can create, update, and delete
the dashboards, reports, and other content of the group.
Create a App Workspace and add members
To create one, simply expand the Workspaces section in the left navigation menu and click
Create App Workspace.
Give the workspace a name. If the corresponding Workspace ID isn't available, edit it to
come up with a unique ID.
This will be the name of the app, too.
You have a few options to set. If you choose Public, anyone in your organization can see
what’s in the workspace. Private, on the other hand, means only members of the workspace
can see its contents.
You can also choose if members can edit or have view-only access.
Only add people to the app workspace so they can edit the content. In Privacy Select
“Members can edit Power BI content” and Add “Workspace members”. If they're only going to
view the content, don't add them to the workspace. You can include them when you publish
the app.
Add email addresses of people you want to have access to the workspace, and select
Add. You can’t add group aliases, just individuals.
Decide whether each person is a member or an admin.
Admins can edit the workspace itself, including adding other members. Members can edit the
content in the workspace, unless they have view-only access. Both admins and members can
publish the app. Select Save.
Power BI creates the workspace and opens it. It appears in the list of workspaces you’re
a member of. Because you’re an admin, you can select the ellipsis (…) to go back and make
changes to it, adding new members or changing their permissions like Member to Admin or vice
versa.
Select Save.
Once save you can see a Workspace with the Name AppWorkspaceNew.
As you created this Workspace you are the Admin for this Workspace. You can Add admins,
members or contributors to this Workspace with different roles by selecting Workspace access.
The new workspaces offer three roles admins, members, and contributors.
Admins can
Update and delete the workspace.
Add/remove people, including other admins.
Do everything members can do.
Members can
Add members or others with lower or equal permissions.
Publish and update an app.
Share an item or share an app.
Allow others to re-share items.
Can’t delete or remove the Members of the Group or App Workspace.
Do everything contributors can do.
Contributors can
Publish reports to the workspace.
Create, edit, and delete content in the workspace.
Can’t modify (Add or Delete) the members of the group.
Can’t share an item or share an app.
Add content, delete content and create new content in App workspace
To publish an app, you need to click the Publish App button in the top-right corner of
the window. You will then be taken to the Publish App page, where you will see three tabs
Details, Content, and Access.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
In the Details tab, you need to enter an App Description to help users understand its
contents. You can also personalize your app by selecting a background color.
In the Content tab, you can see the Power BI content that will be published across
three categories Dashboards, Reports, and Datasets. Workbooks are listed in the Reports
section. At this stage, you cannot exclude any items.
Below the app content, you can specify the app landing page, which is what users who
go to your app will see first. You can choose either of the following below two options.
Specific Content This can be a Dashboard or a Report, which you can select from the
drop-down list below. None Users will see the App Contents page instead of a specific item.
By default, Specific content is selected, though you need to select the landing item. In
our example, we are going to select None.
For your App, you can choose to publish it to the entire organization or for specific
individuals or groups. The default selection is Specific Individuals or Group. If you choose to
keep the setting, you will need to enter email addresses of individuals or groups below.
In our example, we can select Entire Organization. Once we click Finish in the top-
right corner, we will see the Ready to Publish window, where we need to click Publish. After
this, we will see the Successfully Published window.
In this window, you can copy the app link and share it with users to which you have
given access.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Alternatively, to get an app, a user can click Apps in the navigation pane in Power BI
service, and then Get Apps, which will open the AppSource window, shown in Figure
In the AppSource window, they will need to click Get It Now next to the app they want
to get. Note that a user does not need to be a member of the App workspace to get the App.
Unpublishing an App
If you want to unpublish an app, you can do so by clicking the ellipsis in the top-right
corner of the app workspace and clicking Unpublish App. You will need to confirm your action
by clicking Unpublish in the Unpublishing an app window. Doing so will not delete the app
workspace contents, instead, the App will be removed from Apps list of each user and
become inaccessible.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Update a published App
After you publish your app, you can make changes to it if you are an app workspace
admin or a member with edit rights. For this, you need to go to the App workspace and make
the changes you want, once you have made the changes, you need to go back to the app
workspace list of contents and click Update App. You can also update the Details, Content,
and Access settings that you configured when you created the app. Clicking Update App will
open the Ready to update dialog box, where you will need to click Update to propagate the
App changes.
When creating or updating an App, you have an option to exclude some dashboards or
reports from the app. In the app workspace view, there is an Included in App switch next to
each Dashboard, Report, and Workbook; datasets are automatically included in Apps. To
exclude an item from the App, you need to click on the relevant Included in App switch. If
you are excluding items from an app that has already been published, you will need to update
the App.
Organizational Content Pack
Combining or Packing Power BI Content like Dashboards, Reports, Excel Workbooks,
and Datasets is called Organizational Content Pack.
We publish or share this organizational content pack to the team or complete
organization.
Creating and Using Content Packs with Power BI
In order to create a content pack, the Dataset, Workbook, or Report must have
already been deployed to the Power BI site, http://app.powerbi.com. Once the object is on
the site, you will then click on the gears button in the upper right corner of the screen to
open up the settings. Next, you select Create content pack as show below.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
In the Create Content Pack window, enter the following information.
Users Need access to content pack.
Title of Content Pack
Description for Content Pack
Upload an Image for the Content Pack
Select Content / Items to Publish
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
If you have Excel workbooks, you see them under Reports, with an Excel icon. You can add
them to the content pack, too.
Select Publish to add the content pack to the group's organizational content pack library.
You see a success message when it publishes successfully.
To View the content Pack. Select Get Data Organizational Content Pack.
To view the content in Content Pack, Go to corresponding content pack and select Get it now
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
To Mange are Make any Changes to Content Pack, Settings View Content Pack
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
When you select View content pack below window will open. You can go and Edit or
Delete the content pack.
www.abtrainings.com
Row Level Security
Enabling different roles and giving users access to different levels of data is called
Row Level Security. Now we will see how to configure Row Level Security in Power BI
Desktop.
Row Level Security enables you to apply security to roles and adds users to each role.
An example is helpful when you want people from one branch, city, department, or store to
be able to only see their part of the data and not the whole data set. Power BI applies that
through a row level security configuration on the Power BI model itself. So regardless of what
source you are importing your data from, you can apply row level security on it.
Load order table into Power BI and create a Pie Chart for Region wise Sales, Total
Sales in Card Visualization, Region in Slicer and Bar Chart for State Wise Sales.
Creating Roles
Now let’s create roles for that. Our goal here is to build roles for sales manager of Central,
East, South and West Regions. They should each only see their group or Region in the data
set. For creating roles go to Modeling tab in Power BI Desktop. You will see a section named
Security there as shown below.
Click on Manage Roles to create a new role. You will see Manage Roles window which
has three panes as below
You can create or delete roles in numbered one pane, You can see tables in your
model in numbered two pane (for this example you will see one table only, but not now, after
creating the first role), and then you can write your DAX filtering expression in numbered
three pane.
Now Create a Role, and name it as “Central Manager”, you will see one table in the
Tables section i.e., Orders Table. With a click on ellipsis button on table, you can create DAX
filters for each column. From Orders create a filter for Region Column.
Testing Roles in Desktop
We have created our two sample roles. Now let’s test them here. We can test them in
Power BI Desktop with View as Roles menu option. This option allows us to view the report
exactly as the user with this role will see. We can even combine multiple roles to see a
consolidated view of a person who has multiple roles by selecting Ctrl button to select
multiple values or Roles. Go to Modeling tab, and choose View as Role option.
Choose Central Managers, and click on OK. You will see sales for Central Region only
and showing only states of central region.
You can also see in the top of the report there is an information line highlighted
showing that the view is Central Managers. If you click stop viewing, you will see the report as
normal view (total view).
Roles should be assigned to Power BI users (or accounts in other words), and this part
should be done in Power BI Service. Save and publish the report into Power BI. After
publishing the report, click on Security for the data set.
Here you can see roles and assign them to Power BI accounts in your organization.
You can set each user to more than one role, and the user then will have a
consolidated view of both roles. For example, a user with both roles for the Central and East
Managers will see data from All Central and East Regions.
You can also test each role here, just click on ellipsis button beside each role, and
click on Test as Role.
Test as Role will show you the report in view mode for that role. As you see the blue
bar shows that the report showed the role of Central Managers. You can change it there if you
like.
With setting users for each role, now your role level security is ready to work. If the
user login with their account, they will only see data for their roles.
The most important question is why dynamic row level security? To answer this
question, you need to think about the limitation of static row level security. Static row level
security is simple to implement, however, if you have thousands of roles, then it would be a
difficult to maintain. In this case Dynamic Row Level Security is the solution.
By dynamic row-level security, I mean the definition of security be beside the user
account information in the data source. For example when User2 logs in to the system, based
on data tables that show User2 is sales manager for specific Region he should be able to see
only those Region data. This method is possible in Power BI using DAX USERNAME () or
USERPRINCIPALNAME () function.
USERNAME() DESKTOP-HFKOACI\Sunil
USERPRINCIPALNAME() [email protected]
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Data Warehousing Definition
Data Warehousing is the process of constructing a Data Warehouse and using it.
The Operational Systems may be OLTP Databases or Flat Files etc., which stores Transactional
Data.
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
OLTP / Transactional System / Operational System
OLTP stands for Online Transactional Process which stores transactional data.
The Operational systems are where the data is put in.
The users of an operational system turn the wheels of the organization.
Users of an operational system almost always deal with one record at a time.
They repeatedly perform the same operational tasks over and over.
OLAP stands for Online Analytical Process which stores Analytical data that is used
for Analysis and Reporting.
Data Warehouse is where we get the data out.
The users of the Data Warehouse watch the wheels of organization.
Users of the Data Warehouse almost never deal with one row at a time rather,
their questions often require hundreds or thousands of rows are searched and
compressed into an answer set.
Users of a Data Warehouse continuously change the kind of required questions they
ask.
And let us say Country1 data is residing in OLTP1, Country2 data in OLTP2 and Country3 data
in OLTP3.
1. Completely manual, generate different reports from different OLTP’s and integrate
them to get the consolidated report.
2. Fetch all the data from different OLTP’s, made it coherent (consistent manner), load
to Data Warehouse and generate the Reports from Data Warehouse.
1. Less History
The OLTP Systems does not maintain Complete History in order to have the better
transaction performance. So it is not possible to analyze the data completely for a wide
range.
Page | 2
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
2. Performance issue
As the OLTP systems are highly normalized and hence to get the report output
we need to join more number of tables.
Also it is not recommendable to Insert and Retrieve Data from the same system
at the same time.
As we are generating the Reports from OLTP’s on the fly with some data
transformations at the Report level to make data consistent and as it is not possible to test
the reports output every time so there might be a chance of data quality and data consistency
issues and also performance will degrade as we are performing the data transformation.
4. Confident level
Obviously there will be low confident level from the users (BI People)
If we generate reports using Data Warehouse we will overcome the above issues.
There will be no performance issues because we have the complete data from all the
transactional sources in Data Warehouse.
As the data in the Data Warehouse is in de-normalized form, hence to get the report
output you no need to join more number of tables.
There will be no data quality and data consistency issues as a Data Warehouse gets the
preprocessed data from well Designed and Tested ETL code developed using any of the
ETL tools (Informatica).
Page | 3
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
ETL tool provides the facility to extract data from different source systems, transform
the data and load the data into target systems.
To fetch the data from different sources and to make the data coherent or consistent
and to load the data into the Data Warehouse we need ETL Tools.
Need of BI Tools?
As the Business Users don’t know the SQL to communicate with the Databases so we
generate the Reports using any of the BI Tools or Reporting Tools and we will share the
Reports to end users for Analysis.
A Data Warehouse is a Subject Oriented, Integrated, Time Variant and Non Volatile
collection of data in support of management’s decision making process.
--Bill Inmon
Characteristics of Data Warehouse
1. Subject Oriented
Data Warehouse is Subject Oriented rather than Application Oriented. Data in the Data
Warehouse belongs to a specific subject.
2. Integrated
Usually the source data for Data Warehouse is coming from different sources so we will
integrate and load data into Data Warehouse.
3. Time Variant
Data entered into the Data Warehouse belongs to a specific time period. Data
Warehouse will contain entire History of Data and to compare the data we need to maintain
the timestamp for every record loaded into the Data Warehouse.
4. Non Volatile
Page | 4
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
OLTP OLAP
OLAP stands for Online Analytical Process
OLTP stands for Online Transactional Process which stores Analytical Data that is used for
which stores Transactional Data Analysis
Designed to support business transactional Design to support business decision making
process process
Application Oriented Data Subject Oriented Data
Less History Complete History
Designed for Clerical access Designed for Managerial access
Designed using ER Modeling Designed using Dimension Modeling
More joins Less joins
Normalized data (No data redundancy) De Normalized data (Data Redundancy)
Page | 5
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Staging Area
Data Staging Area is a database and is an intermediate storage area between the
Transactional sources and Data Warehouse / Data Mart.
It is usually of temporary in nature, and its contents can be erased after the Data
Warehouse / Data Mart has been loaded successfully.
As we don’t have the access to the data sources throughout the day. So it’s better to
get the data into staging and then to do the transformations on the Data.
Suppose if we need to join 2 Tables data which comes on a particular day. Joining 2
tables in OLTP and filtering the data for a particular day will be time taking process.
So we will get particular day data to the staging database and then we will join.
Page | 6
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
1. An ODS is a database designed to integrate data from multiple sources for additional
operations on the data. It may be passed for further operations and to the
data warehouse for reporting.
The Data Warehouse will not update immediately once the transactions happened in
operational sources.
Data Mart
A Data Mart is a Subject Oriented database which supports the business needs of
specific department business managers.
A Data Mart is a single Subject View and integration of multiple subject views is called
an Enterprise Data Warehouse.
A Data Warehouse is a database provides enterprise business view and Data Mart is
also a database provides department specific business view.
Page | 7
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Top-Down Data Warehouse Design Approach
--Bill Inmon
According to Bill Inmon first we need design an Enterprise Data Warehouse, from EDWH
design the Subject Oriented, department specific databases known Data Marts are Design.
Dependent Data Marts
In Top - Down DWH design approach a Data Mart Development is dependent on EDWH hence
such Data Marts are known as dependent Data Marts.
Page | 8
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Bottom - Up Data Warehouse Design Approach
--Ralph Kimball
According to Ralph Kimball first we need to design subject specific databases know as Data
Marts and the integrate Data Marts into an EDWH.
Independent Data Marts
Page | 9
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Data Warehousing Architecture Overview
Page | 10
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Dimensional Modeling
Dimensional Modeling is used to design OLAP databases.
Dimensional Modeling is a particular design methodology of data modeling wherein the
goal of modeling is to improve query performance.
REGIONS
COUNTRIES GEOGRAPHY
CITIES
Page | 11
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
REGION
REGION_CODE (P.K) REGION_NAME
STH SOUTH
NTH NORTH
WST WEST
EST EAST
COUNTRY
COUNTRY_CODE(P.K) COUNTRY_NAME REGION_CODE(F.K)
IND INDIA STH
SL SRI LANKA STH
PAK PAKISTAN STH
SA SOUTH AFRICA STH
CITY
CITY_CODE(P.K) CITY_NAME COUNTRY_CODE(F.K)
AP ANDHRA PRADESH IND
TG TELANGANA IND
TN TAMIL NADU IND
KA KARNATAKA IND
GEOGRAPHY
GEOGRAPHY_KEY(P.K) REGION_CODE REGION_NAME COUNTRY_CODE COUNTRY_NAME CITY_COD
Page | 12
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
In the process of Data Modeling to design a Data Warehouse using Dimensional Modeling we
will be getting any one of the below schemas as a result.
Data Warehouse Schemas are designed using Dimensional Modeling. A Schema consists
of dimension tables and fact tables.
A dimension table contains dimensions and primary keys.
A fact table contains facts and foreign keys to the dimension tables.
Dimension
A dimension is a descriptive data which describes the key performance indicators know
as facts.
Fact
Profit is a fact, and if I say 1000$ as profit it doesn’t have any meaning and we need to add
some dimensions to a fact to give a meaningful sentence.
Product, Month and Region are the dimensions and, if I say we had a profit of 1000$ by selling
Samsung Mobiles (Product) for the Month of Nov 2015 under the region South, then it give us
the meaningful sentence.
A fact table holds the data to be analyzed, and a dimension table stores data about the ways
in which the data in the fact table can be analyzed.
Page | 13
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Example
Star Schema
A Star Schema is a Data Warehouse database design which contains a centrally located
fact table which is surrounded by multiple dimension tables.
In star schema all the dimensional tables directly connect to the fact table.
Page | 14
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
A Snow Flake Schema consists of a fact table surrounded by multiple dimension tables
which can be connected to other dimension tables.
In snow flake schema some of the dimensions will not directly connect to fact table.
When dimension tables store large number of rows with redundancy of data and space
is such an issue, we can use snow flake schema to save space.
The tables are partially de normalized in structure.
Performance of SQL queries are a bit less when compared to star schema as more
number of joins are involved.
Data Redundancy is low and occupies less disc space when compared to star schema.
In the above figure PRODUCT Dimension is partially normalized.
This schema is viewed as collection of stars hence called Galaxy Schema or Fact
Constellation Schema.
In a Galaxy schema a single dimension table is shared with multiple fact tables.
Page | 15
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Types of Dimensions and Dimension Tables
A Dimension Table that is shared across multiple subject areas or relates to multiple
fact tables within the same data warehouse is known as conformed dimension.
Multiple fact tables are used in Data Warehouse that address multiple business functions such
as Sales, Inventory and Finance etc.
Each business function will typically have its own Schema (Subject Area) and each schema
contains a fact table, some conforming dimension tables and some dimension tables unique to
the specific business function.
Date or Time Dimension is a common conformed dimension because its attributes (day, week,
month, quarter, year etc.) have the same meaning when joined to any fact table.
A Junk Dimension is a collection of random transactional codes or flags or text attributes that
are unrelated to any particular dimension.
The Junk dimension is simply a structure that provides a convenient place to store the Junk
attributes.
Assume that we have a gender dimension and Marital Status dimension as below
Dim_Gender Dim_Marital_Status
Gender_Key Gender_Value Marital_Key Marital_Value
1001 M 2001 Y
1002 F 2002 N
Page | 16
Power BI Analytics Benchmark (AB) Trainings
If we have two dimension tables then in the fact table, we need to maintain two keys
referring to these dimensions.
Instead create a Junk Dimension Dim_Junk which has all the combinations of Gender and
Martial Status (cross join Gender and Martial Status) as below. Now we can maintain only one
key in the fact table.
Dim_Junk
Junk_Key Gender_value Marital_status_value
1001 M Y
1002 M N
1003 F Y
1004 F N
With this Junk dimensional table, we will avoid small dimension tables and maintaining them
and also we will save space in the fact table by avoiding multiple foreign keys.
Role playing dimension refers to a dimension that can play different roles in a fact
table depending on the content.
If one-dimension key is attached to multiple foreign keys in the fact table, then such a kind of
dimension is known as role playing dimension.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
For example, the Date Dimension can be used for the order date, scheduled shipping date,
and shipped date in an order fact table.
In the data warehouse you will have a single dimension table for Dates and you will have
multiple warehouse foreign keys from the fact table to the same dimension.
Shrunken Dimension
E.g. In the above figure Product is the shrunken dimension of Brand and Brand is the shrunken
dimension of Category.
Similarly, Quarter is the Shrunken Dimension of Year and Month is the Shrunken Dimension of
Quarter.
Degenerated Dimension
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
A degenerated dimension is a dimension that is stored in the fact table rather than the
dimension table.
A dimension such as transaction number, receipt number, Invoice number, Bill No etc. does
not have any more associated attributes and hence cannot be designed as a dimension table.
E.g. If you have a dimension that only has Bill number, you would have a 1:1 relation with the
fact table.
Do you want to have two tables with a billion rows or one table with a billion rows?
Therefore, this would be a degenerate dimension and Bill number would be stored in the fact
table.
Inferred Dimensions
While loading fact records, a dimension record may not yet be ready. One solution is
to generate a surrogate key with Null for all the other attributes. This should technically be
called an inferred member, but is often called an inferred dimension.
Based on how frequently the data inside a dimension table changes, we can further classify
dimension as
Static dimensions are not extracted from the original data source, but are created
within the context of the data warehouse. A static dimension can be loaded manually for
example with Status codes or it can be generated by a procedure for example Date or Time
dimension.
Attributes like Age, Location changes over a period of time in Employee Dimension table.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Rapidly Changing Dimension
Types of Fact
Additive Fact
Additive facts are facts that can be summed up through all of the dimensions in the
fact table.
Fact_Sales
Date_Key
Store_Key
Region_Key
Sales
Profit
Date, Store and Region Are Dimensions in the fact table, Sales and Profit are facts.
We can measure day wise sales and profit, store wise sales and Profit, Region wise sales and
profit and all will provide us the correct results.
Semi Additive facts are facts that can be summed up for some of the dimensions in the fact
table, but not the others.
Fact_Daily_Balances
Day_Key
Customer_Key
Balance
Day and Customer are the Dimensions in the fact table, Balance is a fact.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
We can measure the current balance of the customer and will give the meaningful output.
We can also measure the current balance of Day but it doesn’t have any meaning.
Non Additive facts are the facts that cannot be summed up for any of the dimensions present
in the fact table.
A fact table without any facts and has only foreign keys to the dimension tables are
known as fact less fact table.
E.g. A fact table which has only product key and date key is a fact less fact table. There are
no measures in this table. But still you can get the number of products sold over a period of
time.
A fact tables which stores the details of the transactions is known as detailed fact table.
A fact table which stores summary of transactions is known as Additive fact table or
Cumulative fact table.
E.g. This fact table may describe the total sales by Product or by Store or by Day.
Granularity
Granularity refers to the level of detail of the data stored in any tables of a data
warehouse.
High granularity refers to data that is at or near the transaction level. Data that is at the
transaction level is usually referred to as atomic level data.
Low granularity refers to data that is summarized or aggregated, usually from the atomic
level data.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Surrogate Key
Both are primary keys. A natural primary key has some meaning and a surrogate primary key
has no meaning.
A Primary key would be anything that has some meaning and will be used to identify the row
uniquely.
A Surrogate key is something which is having the sequence generated numbers with no
meaning, and just used to identify the row uniquely.
What is ETL?
An ETL application can be developed using programming languages such as SQL and
PL/SQL is said to be a code based ETL.
An ETL application can be designed using simple Graphical User Interface, Point and
Click techniques is said to be GUI based ETL.
www.abtrainings.com
Power BI Analytics Benchmark (AB) Trainings
Examples for GUI based ETL tools
Informatica
Datastage
ODI (Oracle Data Integrator)
Ab Initio
Data Acquisition
Data Acquisition is the process of Extracting, Transforming and Loading the data.
Data Acquisition will be having below processes
Data Extraction (E)
Data Transformation (T)
Data Loading (L)
Data Extraction
It is the process of reading or extracting the data from various types of source systems.
Data Transformation
It is the process of transforming the data into the required business format.
The following are the some of the data processing activities takes place.
Data Cleansing – Removing unwanted data
Data Merging – Joins, Union
Data Scrubbing – Deriving New Attributes
Data Aggregation – Summaries of the detailed data using aggregate functions.
Data Loading
Initial Load
It’s the process of inserting the data records into an empty target table.
At first time load all the required data inserts into destination table.
Incremental Load
It’s the process of inserting only new records after initial load or any Load.
www.abtrainings.com
Data Sources
Power BI
Service
Excel
Files Power BI Desktop
Power 1. Datasets
Power Power
2. Reports
SQL Server Query Pivot View
Reports
Oracle
Set up your report to look how you want, with all the filters properly set, and click the Add
button under Bookmarks.
This will add a bookmark to pane, which you can rename and go back to whenever you want.
You can continue adding as many bookmarks as you want.
If you want to use your bookmarks as a story or in a presentation, you can use the View option
to enter into a view mode for bookmarks.
When in this mode, there is a title bar for each bookmark that includes the bookmark name
and navigation arrows. At this point, you can close the bookmarking pane if you want.
Bookmark links for shapes and images
Creating Home Page or Index Page and linking it to a specific Bookmark.
You can link shapes and images to bookmarks. This is a great feature for creating custom
navigation in your reports or creating buttons that perform different actions across your report.
You’ll find the option in the formatting pane under the Link card. You can pick either Back or
Bookmark as your link type. If you pick bookmark, you’ll have a dropdown to pick one of the
bookmarks you currently have in your report.
Just like the back button, you can activate bookmark buttons by pressing ctrl+click while in
editing mode or just clicking in reading mode.
Changing the Chart Type Dynamically with Selection Pane and Bookmarks
After selecting this item, you will see the selection pane, with list of all visuals. Notice that
there is an eye icon besides every visual. that is the setting for hide/unhide the visual in the
page.
Unhide other visuals
From the list of three charts on the page, unhide two of those, then one which is not hided, is
the column chart.
Create a bookmark
Now to save the state of the page as is, create a bookmark (you have to select the bookmark
pane in the View tab first). I will name this new bookmark as “Column Chart”
Connect button to the bookmark
Now that you have created the bookmark. Click on the button (in this case image boxes of
charts in the right-hand side), and set the action of those to bookmark, and choose the right
bookmark for it.
Repeat this process for the other two types of charts
Create two other bookmarks when you have selected the other two charts individually, and
then assign their buttons to those bookmarks.
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Data Warehousing is the process of constructing a Data Warehouse and using it.
The Operational Systems may be OLTP Databases or Flat Files etc., which stores Transactional Data.
Transactional data describe about a transaction that takes place in an organization. Examples
for Transactions are sales orders, invoices, purchase orders, shipping documents, passport applications,
credit card payments, and insurance claims etc.
OLTP stands for Online Transactional Process which stores transactional data.
The Operational systems are where the data is put in.
The users of an operational system turn the wheels of the organization.
Users of an operational system almost always deal with one record at a time.
They repeatedly perform the same operational tasks over and over.
Page | 1
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
OLAP stands for Online Analytical Process which stores Analytical data that is used for
Analysis and Reporting.
Data Warehouse is where we get the data out.
The users of the Data Warehouse watch the wheels of organization.
Users of the Data Warehouse almost never deal with one row at a time rather, their
questions often require hundreds or thousands of rows are searched and compressed into
an answer set.
Users of a Data Warehouse continuously change the kind of required questions they ask.
And let us say Country1 data is residing in OLTP1, Country2 data in OLTP2 and Country3 data in OLTP3.
1. Completely manual, generate different reports from different OLTP’s and integrate them to
get the consolidated report.
2. Fetch all the data from different OLTP’s, made it coherent (consistent manner), load to Data
Warehouse and generate the Reports from Data Warehouse.
1. Less History
The OLTP Systems does not maintain Complete History in order to have the better transaction
performance. So it is not possible to analyze the data completely for a wide range.
2. Performance issue
As the OLTP systems are highly normalized and hence to get the report output we need
to join more number of tables.
Also it is not recommendable to Insert and Retrieve Data from the same system at the
same time.
As we are generating the Reports from OLTP’s on the fly with some data transformations at the
Report level to make data consistent and as it is not possible to test the reports output every time so
there might be a chance of data quality and data consistency issues and also performance will degrades
as we are performing the data transformation.
Page | 2
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
4. Confident level
Obviously there will be low confident level from the users (BI People)
If we generate reports using Data Warehouse we will overcome the above issues.
OLAP will maintain complete History so that we can make Better Analysis using complete Data.
There will be no performance issues because we have the complete data from all the
transactional sources in Data Warehouse.
As the data in the Data Warehouse is in de-normalized form, hence to get the report output
you no need to join more number of tables.
There will be no data quality and data consistency issues as a Data Warehouse gets the
preprocessed data from well Designed and Tested ETL code developed using any of the ETL
tools (Informatica).
ETL tool provides the facility to extract data from different source systems, transform the data
and load the data into target systems.
To fetch the data from different sources and to make the data coherent or consistent and to
load the data into the Data Warehouse we need ETL Tools.
Need of BI Tools?
As the Business Users don’t know the SQL to communicate with the Databases so we generate
the Reports using any of the BI Tools or Reporting Tools and we will share the Reports to end users for
Analysis.
A Data Warehouse is a copy of transactional data specifically structured for Reporting and
Analysis.
--Ralph Kimball
A Data Warehouse is a Subject Oriented, Integrated, Time Variant and Non Volatile collection
of data in support of management’s decision making process.
--Bill Inmon
Page | 3
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
1. Subject Oriented
Data Warehouse is Subject Oriented rather than Application Oriented. Data in the Data
Warehouse belongs to a specific subject.
2. Integrated
Usually the source data for Data Warehouse is coming from different sources so we will
integrate and load data into Data Warehouse.
3. Time Variant
Data entered into the Data Warehouse belongs to a specific time period. Data Warehouse will
contain entire History of Data and to compare the data we need to maintain the timestamp for every
record loaded into the Data Warehouse.
4. Non Volatile
OLTP OLAP
OLTP stands for Online Transactional Process OLAP stands for Online Analytical Process which
which stores Transactional Data stores Analytical Data that is used for Analysis
Designed to support business transactional process Design to support business decision making process
Application Oriented Data Subject Oriented Data
Less History Complete History
Designed for Clerical access Designed for Managerial access
Designed using ER Modeling Designed using Dimension Modeling
More joins Less joins
Normalized data (No data redundancy) De Normalized data (Data Redundancy)
Page | 4
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Staging Area
Data Staging Area is a database and is an intermediate storage area between the Transactional
sources and Data Warehouse / Data Mart.
It is usually of temporary in nature, and its contents can be erased after the Data Warehouse /
Data Mart has been loaded successfully.
If we have different sources for easy communication we use Data Staging Area.
As we don’t have the access to the data sources throughout the day. So it’s better to get the
data into staging and then to do the transformations on the Data.
Suppose if we need to join 2 Tables data which comes on a particular day. Joining 2 tables in
OLTP and filtering the data for a particular day will be time taking process. So we will get
particular day data to the staging database and then we will join.
Page | 5
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
1. An ODS is a database designed to integrate data from multiple sources for additional
operations on the data. It may be passed for further operations and to the data warehouse for
reporting.
The Data Warehouse will not update immediately once the transactions happened in
operational sources.
Page | 6
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Data Mart
A Data Mart is a Subject Oriented database which supports the business needs of specific
department business managers.
A Data Mart is a single Subject View and integration of multiple subject views is called an
Enterprise Data Warehouse.
A Data Warehouse is a database provides enterprise business view and Data Mart is also a
database provides department specific business view.
Page | 7
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
According to Bill Inmon first we need design an Enterprise Data Warehouse, from EDWH design the
Subject Oriented, department specific databases known Data Marts are Design.
In Top - Down DWH design approach a Data Mart Development is dependent on EDWH hence such Data
Marts are known as dependent Data Marts.
According to Ralph Kimball first we need to design subject specific databases know as Data Marts and
the integrate Data Marts into an EDWH.
In a Bottom – Up Data Warehouse design approach a Data Mart development is independent on EDWH
hence such Data Marts are known as independent Data Marts.
Page | 8
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Page | 9
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Entity – Relationship modeling is a particular design methodology of data modeling wherein the
goal of modeling is to normalize the data by reducing data redundancy.
Dimensional Modeling
Dimensional Modeling is a particular design methodology of data modeling wherein the goal of
modeling is to improve query performance.
Page | 10
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
REGIONS
COUNTRIES GEOGRAPHY
CITIES
REGION
REGION_CODE (P.K) REGION_NAME
STH SOUTH
NTH NORTH
WST WEST
EST EAST
COUNTRY
COUNTRY_CODE(P.K) COUNTRY_NAME REGION_CODE(F.K)
IND INDIA STH
SL SRI LANKA STH
PAK PAKISTAN STH
SA SOUTH AFRICA STH
Page | 11
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
CITY
CITY_CODE(P.K) CITY_NAME COUNTRY_CODE(F.K)
AP ANDHRA PRADESH IND
TG TELANGANA IND
TN TAMIL NADU IND
KA KARNATAKA IND
GEOGRAPHY
GEOGRAPHY_KEY(P.K) REGION_CODE REGION_NAME COUNTRY_CODE COUNTRY_NAME CITY_CODE CITY_NAME
ANDHRA
1001 STH SOUTH IND INDIA AP PRADESH
1002 STH SOUTH IND INDIA TG TELANGANA
1003 STH SOUTH IND INDIA TN TAMIL NADU
1004 STH SOUTH IND INDIA KA KARNATAKA
In the process of Data Modeling to design a Data Warehouse using Dimensional Modeling we will be
getting any one of the below schemas as a result.
1. Star Schema
2. Snow Flake Schema
3. Galaxy Schema or Fact Constellation Schema
Data Warehouse Schemas are designed using Dimensional Modeling. A Schema consists of
dimension tables and fact tables.
A fact table contains facts and foreign keys to the dimension tables.
Dimension
A dimension is a descriptive data which describes the key performance indicators know as
facts.
Page | 12
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Fact
Profit is a fact, and if I say 1000$ as profit it doesn’t have any meaning and we need to add some
dimensions to a fact to give a meaningful sentence.
Product, Month and Region are the dimensions and, if I say we had a profit of 1000$ by selling Samsung
Mobiles (Product) for the Month of Nov 2015 under the region South, then it give us the meaningful
sentence.
A fact table holds the data to be analyzed, and a dimension table stores data about the ways in which
the data in the fact table can be analyzed.
Example
Star Schema
A Star Schema is a Data Warehouse database design which contains a centrally located fact
table which is surrounded by multiple dimension tables.
In star schema all the dimensional tables directly connect to the fact table.
Page | 13
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
A Snow Flake Schema consists of a fact table surrounded by multiple dimension tables which
can be connected to other dimension tables.
In snow flake schema some of the dimensions will not directly connect to fact table.
When dimension tables stores large number of rows with redundancy of data and space is such
an issue, we can use snow flake schema to save space.
Data Redundancy is low and occupies less disc space when compared to star schema.
In the above figure PRODUCT Dimension is partially normalized.
Page | 14
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
This schema is viewed as collection of stars hence called Galaxy Schema or Fact Constellation
Schema.
In a Galaxy schema a single dimension table is shared with multiple fact tables.
Page | 15
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
A Dimension Table that is shared across multiple subject areas or relates to multiple fact tables
within the same data warehouse is known as conformed dimension.
Multiple fact tables are used in Data Warehouse that address multiple business functions such as Sales,
Inventory and Finance etc.
Each business function will typically have its own Schema (Subject Area) and each schema contains a
fact table, some conforming dimension tables and some dimension tables unique to the specific
business function.
Date or Time Dimension is a common conformed dimension because its attributes (day, week, month,
quarter, year etc.) have the same meaning when joined to any fact table.
A Junk Dimension is a collection of random transactional codes or flags or text attributes that are
unrelated to any particular dimension.
The Junk dimension is simply a structure that provides a convenient place to store the Junk attributes.
Assume that we have a gender dimension and Marital Status dimension as below
Dim_Gender Dim_Marital_Status
Gender_Key Gender_Value Marital_Key Marital_Value
1001 M 2001 Y
1002 F 2002 N
If we have two dimension tables then in the fact table we need to maintain two keys referring to these
dimensions.
Page | 16
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Instead create a Junk dimension Dim_Junk which has all the combinations of Gender and Martial Status
(cross join Gender and Martial Status) as below. Now we can maintain only one key in the fact table.
Dim_Junk
Junk_Key Gender_value Marital_status_value
1001 M Y
1002 M N
1003 F Y
1004 F N
With this Junk dimensional table we will avoid small dimension tables and maintaining them and also
we will save space in the fact table by avoiding multiple foreign keys.
Role playing dimension refers to a dimension that can play different roles in a fact table
depending on the content.
If one dimension key is attached to multiple foreign keys in the fact table then such a kind of
dimension is known as role playing dimension.
For example, the Date Dimension can be used for the order date, scheduled shipping date, and shipped
date in an order fact table.
In the data warehouse you will have a single dimension table for Dates and you will have multiple
warehouse foreign keys from the fact table to the same dimension.
Page | 17
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Shrunken Dimension
E.g. In the above figure Product is the shrunken dimension of Brand and Brand is the shrunken
dimension of Category.
Similarly Quarter is the Shrunken Dimension of Year and Month is the Shrunken Dimension of Quarter.
Degenerated Dimension
A degenerated dimension is a dimension that is stored in the fact table rather than the
dimension table.
A dimension such as transaction number, receipt number, Invoice number, Bill No etc. does not have
any more associated attributes and hence cannot be designed as a dimension table.
E.g. If you have a dimension that only has Bill number, you would have a 1:1 relation with the fact
table.
Do you want to have two tables with a billion rows or one table with a billion rows?
Therefore, this would be a degenerate dimension and Bill number would be stored in the fact table.
Page | 18
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Inferred Dimensions
While loading fact records, a dimension record may not yet be ready. One solution is to
generate a surrogate key with Null for all the other attributes. This should technically be called an
inferred member, but is often called an inferred dimension.
Based on how frequently the data inside a dimension table changes, we can further classify dimension
as
Static dimensions are not extracted from the original data source, but are created within the
context of the data warehouse. A static dimension can be loaded manually for example with Status
codes or it can be generated by a procedure for example Date or Time dimension.
Attributes like Age, Location changes over a period of time in Employee Dimension table.
Types of Fact
Additive Fact
Additive facts are facts that can be summed up through all of the dimensions in the fact table.
Fact_Sales
Date_Key
Store_Key
Region_Key
Sales
Profit
Page | 19
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Date, Store and Region are Dimensions in the fact table, Sales and Profit are facts.
We can measure day wise sales and profit, Store wise sales and Profit, Region wise sales and profit and
all will provide us the correct results.
Semi Additive facts are facts that can be summed up for some of the dimensions in the fact table, but
not the others.
Fact_Daily_Balances
Day_Key
Customer_Key
Balance
Day and Customer are the Dimensions in the fact table, Balance is a fact.
We can measure the current balance of the customer and will give the meaningful output.
We can also measure the current balance of Day but it doesn’t have any meaning.
Non Additive facts are the facts that cannot be summed up for any of the dimensions present in the
fact table.
A fact table without any facts and has only foreign keys to the dimension tables are known as
fact less fact table.
E.g. A fact table which has only product key and date key is a fact less fact table. There are no
measures in this table. But still you can get the number of products sold over a period of time.
A fact tables which stores the details of the transactions is known as detailed fact table.
A fact table which stores summary of transactions is known as Additive fact table or Cumulative fact
table.
E.g. This fact table may describe the total sales by Product or by Store or by Day.
Page | 20
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Granularity
Granularity refers to the level of detail of the data stored in any tables of a data warehouse.
High granularity refers to data that is at or near the transaction level. Data that is at the transaction
level is usually referred to as atomic level data.
Low granularity refers to data that is summarized or aggregated, usually from the atomic level data.
Surrogate Key
Surrogate Key is sequentially generated meaningless unique number attached with each and
every record in a table in any Data Warehouse.
This Surrogate Key is generated using database sequences or Sequence Generator Transformation in
Informatica.
Both are primary keys. A natural primary key has some meaning and a surrogate primary key has no
meaning.
A Primary key would be anything that has some meaning and will be used to identify the row uniquely.
A Surrogate key is something which is having the sequence generated numbers with no meaning, and
just used to identify the row uniquely.
An ETL application can be developed using programming languages such as SQL and PL/SQL is
said to be a code based ETL.
An ETL application can be designed using simple Graphical User Interface, Point and Click
techniques is said to be GUI based ETL.
Page | 21
Analytics Benchmark (AB) Trainings DATA WAREHOUSING CONCEPTS
Informatica
Datastage
ODI (Oracle Data Integrator)
Ab Initio
Data Acquisition
Data Acquisition is the process of Extracting, Transforming and Loading the data.
Data Extraction
It is the process of reading or extracting the data from various types of source systems.
Data Transformation
It is the process of transforming the data into the required business format.
The following are the some of the data processing activities takes place.
Data Loading
Initial Load
It’s the process of inserting the data records into an empty target table.
At first time load all the required data inserts into destination table.
Incremental Load
It’s the process of inserting only new records after initial load or any Load.
Page | 22
Visualizing Geographical Data
One of the most exciting ways to visualize data in Power BI is through the various map
options that we have. All the maps serve the same purpose to illustrate data in relation to
locations around the world, but there are some small differences between each of them.
Power BI integrates with Bing Maps to provide default map coordinates (a process called geo-
coding) so you can create maps. Together they use algorithms to identify the correct location,
but sometimes it's a best guess. If Power BI tries can't create the map visualization on its own,
it enlists the help of Bing Maps. All of the maps, except the Shape Map, have the option to
provide the latitude and longitude coordinates, which will be the best way to ensure the
appropriate location is being displayed. The reason for this is because the information that
we provide the visual will be sent to Bing Maps to verify the positioning on the map. If we do
not provide enough detail, then Bing may not return the desired results. For example, if we
were to provide the map visual with a field that contains only the city name, which could
result in some confusion because there may be multiple cities in the US with that name. In
these scenarios, we will either want to supply some sort of geo-hierarchy to give better
definition, or we can create new columns with more detailed information. Power BI also has a
built-in feature when dealing with geographic data that allows users to help identify the type
of data that is being provided, this is called Data Category.
Power BI has several options when it comes to visualizing geospatial data. In this
section, we are going to review two map visuals, Map and Filled Map. You can use the
following field wells.
Color saturation You may use a numerical field here unless you use a Legend.
Power BI service and Power BI Desktop send Bing the geo data it needs to create the
map visualization. This may include the data in the Location, Latitude, and Longitude
buckets.
The first visual we will use to illustrate geographical data is simply called the Map
visual. This visual is also referred to as the Bubble Map because it plots the points of data
with circles that can be set to change in size based off a supplied measure. If you are using a
Legend, your bubbles will be turned into pie charts. If your Legend field well is empty, you
can also use a numerical field for color saturation. Better to pass latitude and longitude
values to the visuals as we may find same city name some times. If we do not have such
detailed data of Latitude and Longitude, so we will need supply the necessary information
through the Location section, which will be sent to Bing Maps.
If you use geographical hierarchies in the Location field well, you will be able to drill
down into specific areas on your map.
When using a geo-hierarchy with a map, enabling the Drill Mode, which is signified by
the down arrow in the upper right, can make this visual even more enjoyable. Remember this
for any visual where we have a hierarchy selected; you should explore the different views it
gives you.
The Filled Map visual
Unlike the traditional Map visual, that uses a bubble to indicate locations, the Filled
Map visual uses shading in proportion across a geography or region to display the geographic
data.
In Power BI, if the dataset you are using has fields for longitude and latitude use them!
Power BI has special buckets to help make the map data unambiguous. Just drag the field
that contains your latitude data into the Visualizations > Latitude area. And do the same for
your longitude data. When you do this, you also need to fill the Location field when creating
your visualizations. Otherwise, the data is aggregated by default, so for example, the latitude
and longitude would be paired at the state level, not the city level.
When your dataset already has different levels of location data, you and your colleagues can
use Power BI to create geo-hierarchies. To do this, drag more than one field into
the Location bucket. Used together in this way, the fields become a geo-hierarchy. In the
example below we have added geo fields for: Country/Region, State, and City. In Power BI
you and your colleagues can drill up and down using this geo-hierarchy.
When drilling with geo-hierarchies, it is important to know how each drill button works and
what gets sent to Bing Maps.
The drill button on the far right, called Drill Mode , allows you to select a map
Location and drill down into that specific location one level at a time. For example, if
you turn Drill Down on and click North America, you move down in the hierarchy to the
next level -- states in North America. For geo-coding, Power BI sends Bing Maps country
and state data for North America only.
On the left there are 2 other drill options. The first option, , drills to the next level
of the hierarchy for all locations at once. For example, if you are currently looking at
countries and then use this option to move to the next level, states, Power BI displays
state data for all countries. For geo-coding, Power BI sends Bing Maps state data (no
country data) for all locations. This option is useful if each level of your hierarchy is
unrelated to the level above it.
The second option, , is similar to Drill Down, except that you don't need to click on
the map. It expands down to the next level of the hierarchy remembering the current
level’s context. For example, if you are currently looking at countries and select this
icon, you move down in the hierarchy to the next level states. For geo-coding, Power
BI sends data for each state and its corresponding country to help Bing Maps geocode
more accurately. In most maps, you will use either this option or the Drill Down option
on the far right, so you can send Bing as much information as possible to get accurate
location information.
Create tooltips based on report pages in Power BI Desktop
You can create visually rich report tooltips that appear when you hover over visuals,
based on report pages you create in Power BI Desktop. By creating a report page that serves
as your tooltip, your custom tooltips can include visuals, images, and any other collection of
items you create in the report page.
You can create as many tooltip pages as you want. Each tooltip page can be associated
with one or more fields in your report, so that when you hover over a visual that includes the
selected field, the tooltip you created on your tooltip page appears when you hover over the
visual, filtered by the data point over which your mouse is hovering.
Create a new report page by clicking the + button, found along the bottom of the
Power BI Desktop canvas, in the page tabs area. The button is located beside the last page in
the report.
Your tooltip can be any size, but keep in mind that tooltips hover over the report
canvas, so you might want to keep them reasonably small. In the Format pane in the Page
Size card, you can see a new page size template called Tooltip. This provides a report page
canvas size that's ready for your tooltip.
By default, Power BI Desktop fits your report canvas to the available space on the
page. Often that's good, but not in the case of tooltips. To get a better sense and view of
what your tooltip will look like when you're done, you can change the Page View to actual
size.
To do that, select the View tab from the ribbon. From there, select Page View
Actual Size, as shown in the following image. Also name the report page (Tooltip1 or Year
wise sales) so its purpose is clear.
From there, you can create whatever visuals you would like to show up in your tooltip as
shown below.
Configure your tooltip report page
Once you have the tooltip report page created, you need to configure the page in
order for Power BI Desktop to register it as a tooltip, and to ensure it appears in over the
right visuals.
To begin with, you need to turn the Tooltip slider to ON, in the Page Information card, to
make the page a tooltip.
Once that slider is set to ON, you specify the fields for which you want the report
tooltip to appear. For visuals in the report that include the field you specify, the tooltip will
appear. You specify which field or fields apply by dragging them into the Tooltip fields
bucket, found in the Fields section of the Visualizations pane. In the following image, the
Category and Sub-Category fields has been dragged into the Tooltips fields bucket. You can
include both categorical and numerical fields in the Tooltips fields bucket, including
measures.
Once completed, the tooltip report page you created will be used as a tooltip in
visuals in the report that use any fields you placed into the Tooltips fields bucket, replacing
the default Power BI tooltip.
Any visual that supports report tooltips now has a Tooltip card in its Formatting pane.
To set a tooltip manually, select the visual for which you want to specify the manual tooltip,
then in the Visualizations pane, select the Format section and expand the Tooltip card.
Then, in the Page dropdown, select the tooltip page you want to use for the selected visual.
Note, only report pages that are specified as Tooltip pages show up in the dialog box.
If you create a manual tooltip for a visual but decide you want the default tooltip
instead, you can always return to the default tooltip that Power BI provides. To do so, when a
visual is selected and the Tooltip card is expanded, just select Auto from the Page dropdown
to go back to the default.