2. Corporate Finance Institute®
Introduction
Download and install Power
BI and recap the basics of
data normalization.
Importing Data
Automate transformations of
complex CSV sales files, saving
you hours of time.
Simple Visualizations
Create interactive dashboard
visuals that impress and
convey a clear message.
Other Dimensions
Join geo-spacial and
category attributes to your
data model, giving you
endless slicing options.
Advanced Techniques
Learn time-Intelligence
to compare periods, the
magic of Calculate and
Filter, as well as
conditional formatting.
Course Outline
The Date Dimension
Slice your analysis by any
time period by creating a
time data table.
Working with Others
Explore features to aid user
navigation, and make use
of the online Power BI
service to share reports.
4. Corporate Finance Institute®
Introduction
Tasks
01. Walkthrough of original data
and finished dashboard.
Skills
02. A tour of the platform, how to
install and sign in.
Download
Power BI
Sign in to
Power BI
A tour of
Power BI
Dashboard
walkthrough
Data
Normalization
Dataset
Overview
5. Corporate Finance Institute®
Database normalization
Example Sales Table
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
Can you see any potential problems with the above 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
6. 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!
7. Corporate Finance Institute®
Database normalization
Sales Fact Table
Product Dimension Table
Order # Date Product # Sales Value USD
307 01/31/2019 80725 192
308 05/14/2019 80726 1,400
309 05/21/2019 80726 1,300
310 07/13/2019 90724 57
Product # Product Group Product
Color
80725 Tools Chrome
80726 Electric Doors White
90724 Radios Black
Date Year
01/31/2019 2019
05/14/2019 2019
05/21/2019 2019
07/13/2019 2019
Date Dimension Table
Normalizing the Sales Table
• Fact tables contain things we measure, and
any attributes that describe the sale.
• Dimension tables add detail and therefore
describe fact table attributes in more detail.
• Metrics (sales) appear in a single column
• Sales attributes describe the sale
• All other attributes are separated into
dimension tables
• No information is repeated
• All tables have a unique identifier for each
row.
8. Corporate Finance Institute®
Data Sets
Sales Fact Table
Date Dimension
Store Dimension
Other Financials Fact Table
ID Store ID Category ID Date Sales $ USD
105 1 7 01/01/2019 400
Date Year Quarter Month Week
01/01/2019 2019 1 1 1
Store ID Store Type Store Size (sqft) Location
1 CORE 151,315 Kansas
Store ID Date Wages Rent Target Sales
7 01/01/2019 #,###.00 #,###.00 #,###.00
Category Dimension Category ID Department Product Group
7 Clothing Sports
10. Corporate Finance Institute®
Importing Data
Tasks
01. Automate the transformation of
CSV sales data.
Skills
02. Manage errors or inconsistencies
that exist in our data.
Import a
CSV File
Delete &
Filter Data
Pivot &
Unpivot Data
Handling
Errors
Working
with Dates
The Advanced
Editor
11. 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
1 Import Sales as CSV
Get Data > Text/CSV > Select Sales retail 2017 – 2019 Excel csv file > Open > Transform
Data
2
Delete unwanted headers
- Deleting unwanted data
- Promote correct headers
Home Tab > Remove Rows > 10
Home Tab > Use First Row as Headers
3 Deleting Previous Steps Delete the first step called Changed Type
4
Filtering Rows & Columns
- Delete the Ref1 Column
- Filter out nulls in the Store column
Home Tab > Remove Column
Store Column > Filter > Uncheck nulls
5
Fill Missing Row Headers down
- Transform blanks to nulls in the Metric column
- Fill down values in the Metric column
Transform > Replace Values
Metric Column > Transform Tab > Fill Down
6
Unpivot Date Columns
- Unpivot other columns
- Rename Attribute column
Select Metric, Store & Cat columns > Transform Tab > Unpivot others
Rename Attribute column to Date
7 Modifying Steps in the Advanced Editor Delete “Columns=160,” from the advanced code for the CSV import
8
Pivoting Columns
- Change the Value column to numbers
- Pivot the Metric column
Value Column > Transform Tab > Data Type > Decimal Number
Metric Column > Transform Tab > Pivot Col > Select Value as Values & SUM as
Aggregation
12. Corporate Finance Institute®
Steps Directions
9
Check Data Types
- Change the date column to date time
- Then change to date
Date column > Transform Tab > Data Type > Date / Time
Date column > Transform Tab > Data Type > Date
10
More Issues with Dates
- Investigate the errors in the Date table
- Delete the date / time step
- Change type using Locale (after Pivot step)
Notice that 57% of date rows are errors
Delete in the Applied Steps area
Click on Pivot Col Step > Right click Date col > change type using Locale > Date/Time UK
11
Thinking about Accessibility
- Copy the CSV file path from the advanced
editor
- Create a parameter to hold the file path
- Replace the filepath with the parameter
name
Advanced editor
Home Tab > New Parameter > SalesFilePathandFullFileName
Replace the filepath in the code, with the parameter
12
Load Data and View Errors
- Rename the query to Sales
- Close and Apply
- Click View Errors
- View error query rows
Click view errors
Back in Power Query click on the new Error query
13
Fixing NA Values
- Delete Error Query Group
- Filter out NA values before Data Type Change
Right click on Query Errors folder > Delete Group
Click on Changed Type step > Transform Tab > Replace Values & Insert Step > Replace NA
for 0
14 Add an ID column Add Column Tab > Index Column > From 1 > Move to left hand side > Load Data
Applied Steps – Importing Data with Power Query (Part 2)
Use these steps to follow along or move quickly through the Importing Data chapter.
13. Corporate Finance Institute®
Here is a summary of the applied Power Query steps from this chapter, as well as the clean data set.
Applied Steps – Importing Data with Power Query Summary
15. Corporate Finance Institute®
Basic Visualizations
Tasks
01. Perform some basic calculations
on our imported data.
Skills
02. Use these calculations to create
clear visualizations of our data.
Create a
Line
Chart
Define Explicit
Measures
Format
Charts
Create a
matrix
DAX formula
notation
Basic DAX
formulas
16. 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.
17. 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
Explicit Measures
- Create an explicit measure SumSales = sum(Sales[Sales])
- Change the table name to SalesFactTable
- The formula will now read SumSales = sum(SalesFactTable[Sales])
- In the line chart, swap the sales column for the SumSales metric
Chart Formatting
Explore the formatting pane to modfify the line chart
- Title text, Title Font Size, Font Color, Background Color
- Delete title placeholder and resize Chart
- Y-Axis Title to Sales $ USD, Grid lines darker grey
- Data Colors to CFI Orange (FA621C)
18. 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 %
19. Corporate Finance Institute®
Applied Steps
Lesson Title Directions
A Simple Matrix
- Delete the title bar for P&L Breakdown by Period
- Add a matrix visual
- Add SumSales to the Values area
- Place Date in the columns
- Change the grid color
- Change the matrix title, color and size
Iterative Formulas like SUMX
- Create a new measure
GM$ = sumx(SalesFactTable,[Sales]*[Margin])
Working with Multiple Measures in a Matrix
- Add GM$ into the matrix
- Show values on rows : Formatting > Values > Show On Rows
- 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 COS and GM% Measures
- Create two new measures:
COS = [SumSales] – [GM$] format with 0 decimal places
GM% = [GM$] / [SumSales] format as % with 2 decimal place
Add both measures to the matrix
KPI Cards
- Add a KPI card to the top left quadrant
- Add SumSales to the card
- Format in millions, and adjust the data value size
- Copy the card and display GM%
- Copy the card a second time
Use these steps as a guide to follow along with the videos.
20. Corporate Finance Institute®
DAX – Data Analysis eXpressions
A simple DAX measure (metric): SumSales = sum(SalesFactTable[Sales])
Date Department Group Sales
June 30, 2017 Kitchen Cutlery 1,051.30
March 31, 2017 Kitchen Cutlery 1,091.54
September 1, 2017 Kitchen Gadgets 1,816.00
December 1, 2017 Kitchen Gadgets 1,957.50
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
A simple DAX calculated column: Group & Dept = [Group] & ": "& [Department]
= 5,916.34
No summarization
Group & Dept
Kitchen: Cutlery
Kitchen: Cutlery
Kitchen: Gadgets
Kitchen: Gadgets
DAX Formula Hints
21. Corporate Finance Institute®
DAX – Visualizing with Context
Store ID SumSales
1 1,051.30
2 2,907.54
6 1,816.00
Total 5,916.34
Dashboard Tables
Date Department Group Store ID Sales
June 30, 2017 Kitchen Cutlery 1 1,051.30
March 31, 2017 Kitchen Cutlery 2 1,091.54
September 1, 2017 Kitchen Gadgets 2 1,816.00
December 1, 2017 Kitchen Gadgets 6 1,957.50
Sales Fact Table
Group & Dept
Kitchen: Cutlery
Kitchen: Cutlery
Kitchen: Gadgets
Kitchen: Gadgets
SumSales
Total 5,916.34
Group & Dept SumSales
Kitchen: Cutlery 2,142.84
Kitchen: Gadgets 3,773.50
Total 5,916.34
“Column headers
can be used to
segment analysis
and create context
in our reports.”
“Measures react to the
change in context, by
adding up the
corresponding rows in our
fact table above.”
22. Corporate Finance Institute®
DAX – Key Points
DAX Calculated
Columns
Are used to create new
data, for every row in
our data table.
DAX
Measures
Are used to aggregate
or summarize several
rows in our data table.
Context
Defines the scope of
the current calculation.
We can introduce
context using any
values in our table.
DAX
Is a language used by
Power BI to help us
create new data, and
perform calculations.
24. Corporate Finance Institute®
The Date Dimension
Tasks
01. Create a re-usable date table
using start & end dates.
Skills
02. Slice our visualizations
interactively using date data.
Defining
Variables
Create a List
of Dates
Adding
Attributes
Creating
Relationships
Working with
Hierarchies
Using slicers
25. Corporate Finance Institute®
Applied Steps
Lesson Title Directions
Defining Start and End Dates for our Date
Table
Define New Source in the Power Query Editor > Blank Query > Advanced Editor
let
StartDate = Date.From(“01/01/2017”),
EndDate = Date.From(“12/31/2019”)
In
Source
Creating a table of consecutive dates
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
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
Adding Descriptive Date Columns Part 2
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])
Add a custom column for WeekID with formula =Text.From([Year])&”W”&Text.From([Week])
Close and Apply the query
Use these steps to define the date table in Power Query.
26. Corporate Finance Institute®
Applied Steps
Lesson Title Directions
Creating Relationships to Enable the Date
Dimension
- Remove SalesFactTable[Date] from the Line Chart
- In the relationship view, creating a relationship between the Date column of each table.
- Add DateDim[Year] to the line chart
Creating a date hierarchy
- Right click on DateDim[Year] in the fields area
- Create 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)
Adding a Slicer
- 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
- 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
Copying slicers across pages
- Copy the slicer onto both other pages
- Click SYNC
Use these steps to bring the date table functionality into your dashboard.
28. Corporate Finance Institute®
Other Dimensions
Tasks
01. Import store and category data
to add detail to our dashboard.
Skills
02. Create impressive visuals with
maps and tree diagrams.
Removing
Prefixes
Commenting
M Code
Create a Map
Visual
Advanced
Formatting
Merging
datasets
Tree maps
and ribbons
29. Corporate Finance Institute®
Applied Steps
Lesson Title Directions
View Sales by Store
- Add a new table visual and include [Store] and [SumSales]
- Change the default summarization of [Store] to Don’t Summarize
- Remove and re-add [Store] to the table.
Manually Import Store Data
- 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
- Ensure that the headers were promoted correctly
- Rename the table to StoreDetails
- Click Edit
Replace Blanks and Fill StoreType Down
- Replace blanks with null in the StoreType Column
- Fill the StoreType column down
Extracting StoreType Using Delimiter - StoreType column > Transform Tab > Extract > Text After Delimiter > Use a colon “:”
Extracting StoreSize Numbers from Text
- StoreSize column > Transform Tab > Split Column > By Digit to Non-Digit
- Rename the Column to StoreSizeSqft
- Change the data type to decimal number
Creating a conditional column to deal with
uncertainty
- StoreLocation column > Transform Tab > Split Column > By Custom Delimiter > “; “
- Add column (conditional)
If [StoreLocation.1] equals USA Division Then [StoreLocation.2] Else [StoreLocation.1]
- Rename the column to State, and delete [StoreLocation.1] and [StoreLocation.2]
Use these steps to define the Store table in Power Query.
30. Corporate Finance Institute®
Applied Steps
Lesson Title Directions
Add Comments
- Add appropriate comments to the advanced query editor, for example:
Loading Data - Close and Apply the StoreDetails table
Use these steps to comment and load the store data.
31. Corporate Finance Institute®
Joining Data Sets
Sales Fact Table
ID Sales $ USD Category ID
105 400 01
107 200 03
108 150 01
109 250 04
Category Dimension
Category ID Department Product Group
01 Clothing Men’s
02 Clothing Women’s
03 Clothing Unisex
04 Clothing Girls
ID Sales $ USD Category ID
105 400 01
107 200 03
108 150 01
109 250 04
Department Product Group
Clothing Men’s
Clothing Unisex
Clothing Men’s
Clothing Girls
A Left Join
“Think of a Left Join like a
vlookup in Excel.”
33. Corporate Finance Institute®
Advanced Techniques
Tasks
01. Import cost and target data to
help complete our P&L.
Skills
02. Master the powerful calculate and
filter functions to get YoY sales.
DAX
Calculate
function
Filter metrics How to rank a
table
DAX Time
intelligence
Report level
filters
Tooltips and
formatting
34. Corporate Finance Institute®
Stores 1-40 Store 99 All Stores
Expense Wages 235m 6m 241m
Expense Rent 295m 10m 305m
Expense Other Costs 0 0 0
Indirect Costs Recap
Current Calculations for 2019 ($ USD)
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
Stores 1-40 Store 99 All Stores
Expense Wages 235m 0 235m
Expense Rent 295m 0 295m
Expense Other Costs 0 16m 16m
35. 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 ? ? ? ?
37. Corporate Finance Institute®
Filtering – Two Methods
Calculate( sum[Rent], filter(StoreDetails,StoreDetails[StoreID]=99) )
StoreID
1
2
3
99
StoreID Rent
1 10
2 15
3 12
99 5
Original context = StoreID = ALL
FILTER respects original filter context, and applies an additional rule.
Calculate( sum[Rent], filter(StoreDetails,StoreDetails[StoreID]=99) )
Original context = StoreID = 1
Filter respects original filter context, and applies an additional rule.
StoreID
1
2
3
99
StoreID Rent
1 10
2 15
3 12
99 5
StoreID Store 99 Rent
ALL 5
Report Visualization
Data Model
StoreID Store 99 Rent
1 0
Stores included in sum
99
Stores included in sum
None
38. Corporate Finance Institute®
Filtering – Two Methods
Calculate( sum[Rent], filter(StoreDetails,StoreDetails[StoreID]=99) )
StoreID
1
2
3
99
StoreID Rent
1 10
2 15
3 12
99 5
Original context = StoreID = 1
FILTER respects original filter context, and applies an additional rule.
Calculate( sum[Rent], StoreDetails[StoreID]=99)
Original context = StoreID = 1
Without FILTER: ignores current filter context, and applies a different
rule.
StoreID
1
2
3
99
StoreID Rent
1 10
2 15
3 12
99 5
StoreID Store 99 Rent
1 0
Report Visualization
Data Model
StoreID Store 99 Rent
1 5
Stores included in sum
None
Stores included in sum
99
40. Corporate Finance Institute®
Working With Others
Tasks
01. Sign into Power BI Service and
share reports with others.
Skills
02. Explore functionality to improve
the user experience.
Create
bookmarks
Custom
themes
Custom
visualizations
Share reports
with others
Power BI
Service Q&A
The Power BI
mobile app