Course Slides - Power BI Fundamentals
Course Slides - Power BI Fundamentals
Tasks
Skills
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:
Can you see any potential problems with the above table?
• 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!
01/01/2019 2019 1 1 1
7 Clothing Sports
Other Financials Fact Table Store ID Date Wages Rent Target Sales
Tasks
Skills
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
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.
Tasks
Skills
Feel free to use these colours to brand your dashboard with CFI colours.
Income Revenue $
Expense Cost of Sales $
Gross Profit $
Gross Margin %
Expense Wages $
Expense Rent $
Expense Other Costs $
EBIT $ or %
Date Department Group Sales Group & Dept Calculated Columns add an entire
column of new values to a table.
June 30, 2017 Kitchen Cutlery 1,051.30 Kitchen: Cutlery
We get 1 new value for each row.
March 31, 2017 Kitchen Cutlery 1,091.54 Kitchen: Cutlery
September 1, 2017 Kitchen Gadgets 1,816.00 Kitchen: Gadgets Note: In Tableau, this is referred to as
a Row Level calculation.
December 1, 2017 Kitchen Gadgets 1,957.50 Kitchen: Gadgets
Group & Dept = [Group] & ": "& [Department]
= 5,916.34
Measures are used to calculate
something, which typically summarizes
values across rows in a table.
SumSales = sum(SalesFactTable[Sales])
SUMX(SalesFactTable, [Sales]*[Margin] ) =
1051.30 * 0.39 row level result of [sales] * [margin]
+
1091.54 * 0.33 row level result of [sales] * [margin]
+
1816.00 * 0.32 row level result of [sales] * [margin]
+
1957.50 * 0.34 row level result of [sales] * [margin]
= 2,016.89
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
Dashboard Tables
By adding Department to the Likewise, by adding individual dates to Instead of individual dates, we could
rows of a table, we change the the x-axis of a line chart, each data summarize dates by quarter, again
context of each calculation. point now has a different filter context. giving each data point a new context.
• First row context: Clothing • First data point context: 1st Jan 2017 • First data point context: 2017 Q1
• Second row context: Electronics • Second data point context: 2nd Jan 2017 • Second data point context: 2017 Q2
• etc • etc • etc
Tasks
Skills
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
Adding Descriptive Date Columns Part 1 Add a column for Year, Quarter, Month and Week number
Working with Two Charts - Replace the dates in the matrix with the date hierarchy (in columns)
Modifying chart interactions - Edit the slicer interactions so that it doesn’t affect the timeline
Tasks
Skills
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]
A Left Join
ID Sales $ USD Category ID Department Product Group
Tasks
Skills
DAX Calculate Filter metrics How to rank a DAX Time Report level Tooltips and
function table intelligence filters formatting
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 ? ? ? ?
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.
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.
Tasks
Skills
This chapter does not have any accompanying slides. The methods for sharing dashboards and improving the user
experience in this chapter are explored within Power BI through the course videos.