You are on page 1of 40

Power BI - Fundamentals

Corporate Finance Institute®


Course Outline

Introduction Importing Data Simple Visualizations The Date Dimension


Download and install Power Automate transformations of Create interactive dashboard Slice your analysis by any
BI and recap the basics of complex CSV sales files, saving visuals that impress and time period by creating a
data normalization. you hours of time. convey a clear message. time data table.

Other Dimensions Advanced Techniques Working with Others


Join geo-spacial and Learn time-Intelligence Explore features to aid user
category attributes to your to compare periods, the navigation, and make use
data model, giving you magic of Calculate and of the online Power BI
endless slicing options. Filter, as well as service to share reports.
conditional formatting.

Corporate Finance Institute®


Power BI - Introduction

Corporate Finance Institute®


Introduction

Tasks

01. Walkthrough of original data


and finished dashboard. 02. A tour of the platform, how to
install and sign in.

Skills

Download Sign in to A tour of Dashboard Data Dataset


Power BI Power BI Power BI walkthrough Normalization Overview

Corporate Finance Institute®


Database normalization

Data normalization is the process of transforming data into an efficient and robust form for storage and analysis. The
benefits of normalization can be summarized as:

• Protects data integrity


• Reduces storage space
• Easier to maintain
• Improves query speed

Example Sales Table


Sales Value USD Year 2019 2019 2019 2019

Product # Product Group Product Color 01/31/2019 05/14/2019 05/21/2019 07/13/2019

80725 Tools Chrome 192 0 0 0

80726 Electric Doors White 0 1,400 0 0

80726 Electric Doors White 0 0 1,300 0

90724 Radios Black 0 0 0 57

Can you see any potential problems with the above table?

Corporate Finance Institute®


Database normalization

Example Sales Table


Sales Value USD Year 2019 2019 2019 2019

Product # Product Group Product Color 01/31/2019 05/14/2019 05/21/2019 07/13/2019

80725 Tools Chrome 192 0 0 0

80726 Electric Doors White 0 1,400 0 0

80726 Electric Doors White 0 0 1,300 0

90724 Radios Black 0 0 0 57

This table has four key problems:

• Product group and colour are repeated between the 2nd and the 3rd line items.
• We have no way to identify these orders with a unique number.
• By displaying the date over columns, we have to store unnecessary 0’s.
• This is a sales table, so all attributes should describe the sale. Product color describes the product!

Corporate Finance Institute®


Database normalization

Sales Fact Table


Normalizing the Sales Table
Order # Date Product # Sales Value USD
• Fact tables contain things we measure, and
307 01/31/2019 80725 192 any attributes that describe the sale.
308 05/14/2019 80726 1,400
• Dimension tables add detail and therefore
309 05/21/2019 80726 1,300 describe fact table attributes in more detail.
310 07/13/2019 90724 57
• Metrics (sales) appear in a single column

• Sales attributes describe the sale


Product Dimension Table Date Dimension Table
• All other attributes are separated into
Product # Product Group Product Date Year dimension tables
Color
01/31/2019 2019
80725 Tools Chrome • No information is repeated
05/14/2019 2019
80726 Electric Doors White
05/21/2019 2019 • All tables have a unique identifier for each
90724 Radios Black row.
07/13/2019 2019

Corporate Finance Institute®


Data Sets

Sales Fact Table ID Store ID Category ID Date Sales $ USD

105 1 7 01/01/2019 400

Date Dimension Date Year Quarter Month Week

01/01/2019 2019 1 1 1

Store Dimension Store ID Store Type Store Size (sqft) Location

1 CORE 151,315 Kansas

Category Dimension Category ID Department Product Group

7 Clothing Sports

Other Financials Fact Table Store ID Date Wages Rent Target Sales

7 01/01/2019 #,###.00 #,###.00 #,###.00

Corporate Finance Institute®


Power BI Fundamentals
Importing Data

Corporate Finance Institute®


Importing Data

Tasks

01. Automate the transformation of


CSV sales data. 02. Manage errors or inconsistencies
that exist in our data.

Skills

Import a Delete & Pivot & Handling Working The Advanced


CSV File Filter Data Unpivot Data Errors with Dates Editor

Corporate Finance Institute®


Applied Steps – Importing Data with Power Query (Part 1)

Use these steps to follow along or move quickly through the Importing Data chapter.
Steps Directions
Get Data > Text/CSV > Select Sales retail 2017 – 2019 Excel csv file > Open > Transform
1 Import Sales as CSV
Data
Delete unwanted headers
2 - Deleting unwanted data Home Tab > Remove Rows > 10
- Promote correct headers Home Tab > Use First Row as Headers

3 Deleting Previous Steps Delete the first step called Changed Type

Filtering Rows & Columns


4 - Delete the Ref1 Column Home Tab > Remove Column
- Filter out nulls in the Store column Store Column > Filter > Uncheck nulls
Fill Missing Row Headers down
5 - Transform blanks to nulls in the Metric column Transform > Replace Values
- Fill down values in the Metric column Metric Column > Transform Tab > Fill Down
Unpivot Date Columns
6 - Unpivot other columns Select Metric, Store & Cat columns > Transform Tab > Unpivot others
- Rename Attribute column Rename Attribute column to Date

7 Modifying Steps in the Advanced Editor Delete “Columns=160,” from the advanced code for the CSV import

Pivoting Columns
Value Column > Transform Tab > Data Type > Decimal Number
8 - Change the Value column to numbers
Metric Column > Transform Tab > Pivot Col > Select Value as Values & SUM as
- Pivot the Metric column
Aggregation
Corporate Finance Institute®
Applied Steps – Importing Data with Power Query (Part 2)

Use these steps to follow along or move quickly through the Importing Data chapter.
Steps Directions
Check Data Types
9 - Change the date column to date time Date column > Transform Tab > Data Type > Date / Time
- Then change to date Date column > Transform Tab > Data Type > Date
More Issues with Dates
- Investigate the errors in the Date table Notice that 57% of date rows are errors
10
- Delete the date / time step Delete in the Applied Steps area
- Change type using Locale (after Pivot step) Click on Pivot Col Step > Right click Date col > change type using Locale > Date/Time UK
Thinking about Accessibility
- Copy the CSV file path from the advanced
editor Advanced editor
11
- Create a parameter to hold the file path Home Tab > New Parameter > SalesFilePathandFullFileName
- Replace the filepath with the parameter Replace the filepath in the code, with the parameter
name
Load Data and View Errors
- Rename the query to Sales
12 - Close and Apply
- Click View Errors Click view errors
- View error query rows Back in Power Query click on the new Error query

Fixing NA Values
Right click on Query Errors folder > Delete Group
13 - Delete Error Query Group
Click on Changed Type step > Transform Tab > Replace Values & Insert Step > Replace NA
- Filter out NA values before Data Type Change
for 0

14 Add
Corporate anInstitute®
Finance ID column Add Column Tab > Index Column > From 1 > Move to left hand side > Load Data
Applied Steps – Importing Data with Power Query Summary

Here is a summary of the applied Power Query steps from this chapter, as well as the clean data set.

Corporate Finance Institute®


Power BI Fundamentals
Basic Visualizations

Corporate Finance Institute®


Basic Visualizations

Tasks

01. Perform some basic calculations


on our imported data. 02. Use these calculations to create
clear visualizations of our data.

Skills

Create a Define Explicit Format Create a DAX formula Basic DAX


Line Measures Charts matrix notation formulas
Chart

Corporate Finance Institute®


CFI Colors

Feel free to use these colours to brand your dashboard with CFI colours.

Name HEX Code Description


CFI Cyan 25A2AF Used as a primary branding color in charts and tables.
CFI Dark Blue 132E57 Used for heading shading, sub-titles and key metrics.
CFI Orange FA621C Used as an accent color to highlight key messages.
CFI Red C32828 Used to convey negative, (bad) results.
CFI Green 1F995B Used to convey positive, (good) results.
CFI Purple 6B007B Additional color for categorization if necessary.
CFI Pink E044A7 Additional color for categorization if necessary.
CFI Background Grey F8F9FA Used as a neutral color for heading backgrounds.

Corporate Finance Institute®


Applied Steps

Use these steps as a guide to follow along with the videos.


Lesson Title Directions

A Simple Line Area Chart - Create a simple line chart showing sales by date

- Create an explicit measure SumSales = sum(Sales[Sales])


- Change the table name to SalesFactTable
Explicit Measures
- The formula will now read SumSales = sum(SalesFactTable[Sales])
- In the line chart, swap the sales column for the SumSales metric

Explore the formatting pane to modfify the line chart


- Title text, Title Font Size, Font Color, Background Color
Chart Formatting
- Delete title placeholder and resize Chart
- Y-Axis Title to Sales $ USD, Grid lines darker grey
- Data Colors to CFI Orange (FA621C)

Corporate Finance Institute®


The Profit and Loss Statement (P&L)

• The P&L is a summary of a company’s incoming and outgoing transactions.


• Transactions can be summarized into two categories: income and expenses.
• Those summaries help us calculate standard metrics, which allow us to evaluate the financial health of a company.

Income Revenue $
Expense Cost of Sales $
Gross Profit $
Gross Margin %

Expense Wages $
Expense Rent $
Expense Other Costs $
EBIT $ or %

Corporate Finance Institute®


Applied Steps

Use these steps as a guide to follow along with the videos.


Lesson Title Directions
- Delete the title bar for P&L Breakdown by Period
- Add a matrix visual
- Add SumSales to the Values area
A Simple Matrix - Place Date in the columns

- Change the grid color


- Change the matrix title, color and size
- Create a new measure
Iterative Formulas like SUMX
GM$ = sumx(SalesFactTable,[Sales]*[Margin])
- Add GM$ into the matrix
- Show values on rows : Formatting > Values > Show On Rows
Working with Multiple Measures in a Matrix - Change the formatting of SumSales to have no decimal places
- Change the formatting of GM$ to have no decimal places
- Rename how the measures appear in the visual to Sales & GM
- Create two new measures:
COS = [SumSales] – [GM$] format with 0 decimal places
Create COS and GM% Measures
GM% = [GM$] / [SumSales] format as % with 2 decimal place
Add both measures to the matrix
- Add a KPI card to the top left quadrant
- Add SumSales to the card
KPI Cards - Format in millions, and adjust the data value size
- Copy the card and display GM%
- Copy the card a second time
Corporate Finance Institute®
DAX – Data Analysis eXpressions
What is DAX?
DAX is used to write formulas in Power BI, but also in Power Pivot for Excel. These formulas can help us create, aggregate or summarize
data in our reports. DAX formulas can be categorized into one of two groups: Calculated Columns and Measures.

Sales Fact Table

Date Department Group Sales Group & Dept

June 30, 2017 Kitchen Cutlery 1,051.30 Kitchen: Cutlery

March 31, 2017 Kitchen Cutlery 1,091.54 Kitchen: Cutlery

September 1, 2017 Kitchen Gadgets 1,816.00 Kitchen: Gadgets

December 1, 2017 Kitchen Gadgets 1,957.50 Kitchen: Gadgets

A simple DAX measure (metric): SumSales = sum(SalesFactTable[Sales]) = 5,916.34


A simple DAX calculated column: Group & Dept = [Group] & ": "& [Department] No summarization

DAX Formula Hints

Corporate Finance Institute®


DAX – Visualizing with Context
Sales Fact Table

Date Department Group Store ID Sales Group & Dept “Column headers
can be used to
June 30, 2017 Kitchen Cutlery 1 1,051.30 Kitchen: Cutlery segment analysis
and create context
March 31, 2017 Kitchen Cutlery 2 1,091.54 Kitchen: Cutlery
in our reports.”
September 1, 2017 Kitchen Gadgets 2 1,816.00 Kitchen: Gadgets

December 1, 2017 Kitchen Gadgets 6 1,957.50 Kitchen: Gadgets

Dashboard Tables

SumSales Store ID SumSales Group & Dept SumSales

Total 5,916.34 1 1,051.30 Kitchen: Cutlery 2,142.84

2 2,907.54 Kitchen: Gadgets 3,773.50


“Measures react to the
change in context, by 6 1,816.00 Total 5,916.34
adding up the
Total 5,916.34
corresponding rows in our
fact table above.”

Corporate Finance Institute®


DAX – Key Points

DAX DAX DAX Calculated Context


Measures Columns

Is a language used by Are used to aggregate Defines the scope of


Are used to create new
Power BI to help us or summarize several the current calculation.
data, for every row in
create new data, and rows in our data table. We can introduce
our data table.
perform calculations. context using any
values in our table.

Corporate Finance Institute®


Power BI – The Date Dimension

Corporate Finance Institute®


The Date Dimension

Tasks

01. Create a re-usable date table


using start & end dates. 02. Slice our visualizations
interactively using date data.

Skills

Defining Create a List Adding Creating Working with Using slicers


Variables of Dates Attributes Relationships Hierarchies

Corporate Finance Institute®


Applied Steps
Use these steps to define the date table in Power Query.
Lesson Title Directions

Define New Source in the Power Query Editor > Blank Query > Advanced Editor
let
Defining Start and End Dates for our Date StartDate = Date.From(“01/01/2017”),
Table EndDate = Date.From(“12/31/2019”)
In
Source

let
StartDate = Date.From(“01/01/2017”),
EndDate = Date.From(“12/31/2019”)
FullDates = List.Dates(StartDate, Number.From(EndDate) –
Number.From(StartDate)+1,#duration(1,0,0,0))
In
Creating a table of consecutive dates
FullDates

- Convert the resulting list to a table. Leave the options as default.


- Rename the column to date.
- Change the column type to date
- Rename the table to DateDim

Adding Descriptive Date Columns Part 1 Add a column for Year, Quarter, Month and Week number

Add a custom column for QuarterID with formula =Text.From([Year])&”Q”&Text.From([Quarter])


Add a custom column for MonthID with formula =Text.From([Year])&”M”&Text.From([Month])
Adding Descriptive Date Columns Part 2
Add a custom column for WeekID with formula =Text.From([Year])&”W”&Text.From([Week])
Close and Apply the query
Corporate Finance Institute®
Applied Steps
Use these steps to bring the date table functionality into your dashboard.
Lesson Title Directions
- Remove SalesFactTable[Date] from the Line Chart
Creating Relationships to Enable the Date
- In the relationship view, creating a relationship between the Date column of each table.
Dimension
- Add DateDim[Year] to the line chart
- Right click on DateDim[Year] in the fields area
- Create hierarchy
Creating a date hierarchy - Drag QuarterID and WeekID into the hierarchy
- Replace DateDim[Year] with the new date hierarchy
- Sort the timeline by QuarterID ascending

Working with Two Charts - Replace the dates in the matrix with the date hierarchy (in columns)

- Add a date slicer from the visualization pane


- Add the date hierarchy (year) to the slicer
- Change the options using the drop down, and select Drop down
Adding a Slicer - In formatting pane, change the selection controls to single select
- Disable the slicer header and place the slicer in the top right of the page
- Turn the slicer background off
- Change the items background to BLUE and the font color to WHITE

Modifying chart interactions - Edit the slicer interactions so that it doesn’t affect the timeline

- Copy the slicer onto both other pages


Copying slicers across pages
- Click SYNC

Corporate Finance Institute®


Power BI Fundamentals
Other Dimensions

Corporate Finance Institute®


Other Dimensions

Tasks

01. Import store and category data


to add detail to our dashboard. 02. Create impressive visuals with
maps and tree diagrams.

Skills

Removing Commenting Create a Map Advanced Merging Tree maps


Prefixes M Code Visual Formatting datasets and ribbons

Corporate Finance Institute®


Applied Steps
Use these steps to define the Store table in Power Query.
Lesson Title Directions

- Add a new table visual and include [Store] and [SumSales]


View Sales by Store - Change the default summarization of [Store] to Don’t Summarize
- Remove and re-add [Store] to the table.

- On the Home tab click Enter Data


- Copy the store details table from the store details xls file
- Paste the data into the Enter Data area
Manually Import Store Data
- Ensure that the headers were promoted correctly
- Rename the table to StoreDetails
- Click Edit
- Replace blanks with null in the StoreType Column
Replace Blanks and Fill StoreType Down
- Fill the StoreType column down

Extracting StoreType Using Delimiter - StoreType column > Transform Tab > Extract > Text After Delimiter > Use a colon “:”

- StoreSize column > Transform Tab > Split Column > By Digit to Non-Digit
Extracting StoreSize Numbers from Text - Rename the Column to StoreSizeSqft
- Change the data type to decimal number
- StoreLocation column > Transform Tab > Split Column > By Custom Delimiter > “; “
Creating a conditional column to deal with - Add column (conditional)
uncertainty If [StoreLocation.1] equals USA Division Then [StoreLocation.2] Else [StoreLocation.1]
- Rename the column to State, and delete [StoreLocation.1] and [StoreLocation.2]

Corporate Finance Institute®


Applied Steps
Use these steps to comment and load the store data.
Lesson Title Directions

- Add appropriate comments to the advanced query editor, for example:


Add Comments

Loading Data - Close and Apply the StoreDetails table

Corporate Finance Institute®


Joining Data Sets

Sales Fact Table Category Dimension


ID Sales $ USD Category ID Category ID Department Product Group

105 400 01 01 Clothing Men’s

107 200 03 02 Clothing Women’s

108 150 01 03 Clothing Unisex

109 250 04 04 Clothing Girls

A Left Join
ID Sales $ USD Category ID Department Product Group

105 400 01 Clothing Men’s


“Think of a Left Join like a
107 200 03 Clothing Unisex vlookup in Excel.”
108 150 01 Clothing Men’s

109 250 04 Clothing Girls

Corporate Finance Institute®


Power BI Fundamentals
Advanced Techniques

Corporate Finance Institute®


Advanced Techniques

Tasks

01. Import cost and target data to


help complete our P&L. 02. Master the powerful calculate and
filter functions to get YoY sales.

Skills

DAX Filter metrics How to rank a DAX Time Report level Tooltips and
Calculate table intelligence filters formatting
function

Corporate Finance Institute®


Indirect Costs Recap

Current Calculations for 2019 ($ USD)

Stores 1-40 Store 99 All Stores

Expense Wages 235m 6m


0 241m
235m

Expense Rent 295m 10m


0 305m
295m

Expense Other Costs 0 16m


0 16m
0

Desired Calculations for 2019 ($ USD)


Stores 1-40 Store 99 All Stores

Expense Wages 235m 0 235m

Expense Rent 295m 0 295m

Expense Other Costs 16m 0 16m

Corporate Finance Institute®


Formula for Other Costs

Store 1 Other Costs = ( Store 1 Sales / Total Sales ) x ( Store 99 Rent + Store 99 Wages )

Store ID Other Costs Store Sales Total Sales Store 99 Rent Store 99 Wages

1 Answer ? ? ? ?

99 Answer ? ? ? ?

ALL Answer ? ? ? ?

Corporate Finance Institute®


Filtering – Two Methods

“To filter or not to filter, that is the question.”

Corporate Finance Institute®


Filtering – Two Methods
Data Model Report Visualization

StoreID StoreID Rent StoreID Store 99 Rent Stores included in sum

1 1 10 ALL 5 99

2 2 15
Calculate( sum[Rent], filter(StoreDetails,StoreDetails[StoreID]=99) )
3 3 12
Original context = StoreID = ALL
99 99 5
FILTER respects original filter context, and applies an additional rule.

StoreID StoreID Rent StoreID Store 99 Rent Stores included in sum


1 1 10 1 0 None
2 2 15
Calculate( sum[Rent], filter(StoreDetails,StoreDetails[StoreID]=99) )
3 3 12

99 99 5 Original context = StoreID = 1

Filter respects original filter context, and applies an additional rule.

Corporate Finance Institute®


Filtering – Two Methods
Data Model Report Visualization

StoreID StoreID Rent StoreID Store 99 Rent Stores included in sum

1 1 10 1 0 None

2 2 15
Calculate( sum[Rent], filter(StoreDetails,StoreDetails[StoreID]=99) )
3 3 12
Original context = StoreID = 1
99 99 5
FILTER respects original filter context, and applies an additional rule.

StoreID StoreID Rent StoreID Store 99 Rent Stores included in sum


1 1 10 1 5 99
2 2 15
Calculate( sum[Rent], StoreDetails[StoreID]=99)
3 3 12
Original context = StoreID = 1
99 99 5
Without FILTER: ignores current filter context, and applies a different
rule.

Corporate Finance Institute®


Power BI – Working with Others

Corporate Finance Institute®


Working With Others

Tasks

01. Sign into Power BI Service and


share reports with others. 02. Explore functionality to improve
the user experience.

Skills

Create Custom Custom Share reports Power BI The Power BI


bookmarks themes visualizations with others Service Q&A mobile app

Corporate Finance Institute®

You might also like