Intro and Exercice Power Query
Intro and Exercice Power Query
MSPTDA 03: Microsoft Power Tools for Data Analysis Video Topics:
1) Clean and Transform Data in Excel
Microsoft Power Tools for Data Analysis 2) Look at Power Query User Interface & M
ower Pivot Data Model, Power BI Desktop Data Model, Connection Only.
lace Complex Array Formula Solutions.
Based Case Sensitive Language called M Code.
tions can be done with the User Interface or with directly authoring the M Code.
ry Process is Automatically Documented and can be Edited Later.
Created, We can Refresh that Useful Information when New Data Arrives,
Modify the Power Query Process.
Example #1: Convert "NOT a Proper Data Set" into a Proper Data Set & Make PivotTable Report
Clean & Transform Data Data from an Excel Sheet
1) Convert Excel Data to Excel Table in order to get it into Power Query
2) Break Product, Date and Region Fields apart into 3 Separate Fields
3) Load Back to Excel
Make PivotTable
4) Make PivotTable
Have Cleaning Data and PivotTable UPDATE when Source Data Changes.
5) Add new data to table
6) Refresh PivotTable
Description Amount
Example #3: Import Multiple Text Files and Append into Single Table in Power BI Desktop
Extract & Import
1) Connect to Folder that Contains Tab Delimited Text Table Files
Transform Data
2) Append Tables
3) Load to Power BI Data Model
2/17/2018 Ban
2/18/2018 Tyrone Quad
2/18/2018 Chin Aspen
2/16/2018 Chin Yanaki
Yanaki
267.84
1021.48
1401.89
924.27
Date SalesRep Product Sales SalesRep Product
2/16/2018 Sioux Quad 352.46 Sioux Quad
2/16/2018 Sioux Yanaki 1378.85 Tyrone Sunshine
2/17/2018 Chin Yanaki 1458.2 Chin Aspen
2/19/2018 Tyrone Yanaki 142.35 Ban Yanaki
Data Types in Power Query - with Long Definition
Decimal Number – Represents a 64 bit (eight-byte) floating point number. It’s the most common number typ
numbers as you usually think of them. Although designed to handle numbers with fractional values, it also
Decimal Number type can handle negative values from -1.79E +308 through -2.23E -308, 0, and positive va
1.79E + 308. For example, numbers like 34, 34.01, and 34.000367063 are valid decimal numbers. The larges
represented in a Decimal Number type is 15 digits long. The decimal separator can occur anywhere in the n
type corresponds to how Excel stores its numbers.
Fixed Decimal Number – Has a fixed location for the decimal separator. The decimal separator always has four
for 19 digits of significance. The largest value it can represent is 922,337,203,685,477.5807 (positive or nega
Number type is useful in cases where rounding might introduce errors. When you work with many number
values, they can sometimes accumulate and force a number to be slightly off. Since the values past the fou
separator are truncated, the Fixed Decimal type can help you avoid these kinds of errors. If you’re familiar w
corresponds to SQL Server’s Decimal (19,4), or the Currency Data type in Power Pivot.
Whole Number – Represents a 64 bit (eight-byte) integer value. Because it’s an integer, it has no digits to the
allows for 19 digits; positive or negative whole numbers between -9,223,372,036,854,775,808 (-2^63) and 9
(2^63-1). It can represent the largest possible number of the various numeric data types. As with the Fixed
Number type can be useful in cases where you need to control rounding.
Date/Time – Represents both a date and time value. Underneath the covers, the Date/Time value is stored a
you can actually convert between the two. The time portion of a date is stored as a fraction to whole multip
ms). Dates between years 1900 and 9999 are supported.
Date – Represents just a Date (no time portion). When converted into the model, a Date is the same as a Da
the fractional value.
Time – Represents just Time (no Date portion). When converted into the model, a Time value is the same as
digits to the left of the decimal place.
Date/Time/Timezone – Represents a UTC Date/Time. Currently, it’s converted into Date/Time when loaded int
Duration – Represents a length of time. It’s converted into a Decimal Number Type when loaded into the mo
type it can be added or subtracted from a Date/Time field with correct results. As a Decimal Number type,
visualizations that show magnitude.
Text - A Unicode character data string. Can be strings, numbers, or dates represented in a text format. Maxi
268,435,456 Unicode characters (256 mega characters) or 536,870,912 bytes.
True/False – A Boolean value of either a True or False.
Data Types in Power Query
Decimal Number
Fixed Decimal Number
Whole Number
Date/Time
Date
Time
Date/Time/Timezone
Duration
Text
Ture/False
Short Definition
Max 15 digital
Max 4 decimals to right of decimal
No digits to right of decimal
Date and Time together
Just Date
Just Time
Same as Date and Time
Length of Time
Text - max length 268,435,456 Unicode characters
Ture/False