SlideShare a Scribd company logo
1 of 30
Power Query M?
(Informally known as "M")
The Power Query Formula Language is a powerful query
language optimized for building queries that mashup data. It's a
functional, case sensitive language.
For computer language theorists: Power Query is a mostly pure,
higher-order, dynamically typed, partially lazy, functional
language. You can create a variety of data mashup queries from
simple to advanced scenarios.
(Source: MSDN)
Power Query?!
(Data Connectivity and Preparation)
Power Query enables business users to seamlessly access data stored in
hundreds of data sources and reshape it to fit their needs, with an easy to
use, engaging and no-code user experience.
Data Connectors:
(Source: Office Support)
Access Database2 Hadoop File (HDFS) Microsoft Azure Table Storage PostgreSQL Database Text
Active Directory IBM DB2 Database Microsoft Exchange SharePoint List CSV
Excel Microsoft Azure HDInsight MySQL Database SQL Server Database Web Page
Facebook Microsoft Azure Marketplace OData Feed Sybase Database XML
Folder Microsoft Azure SQL Database Oracle Database Teradata Database And More…
“M”
POWER QUERY
FOR POWER BI
Alex M PowersPremier Field Engineer – Data & AI @ Microsoft
Co-Organizer St Louis Power BI User Group #STLPBIUG
Professional:
• Microsoft Certified Solutions Expert: Data Management and Analytics
• Microsoft Certified Solutions Associate: BI Reporting (Excel, Power BI)
• Microsoft Certified Associate: Azure AI Engineer
• Microsoft Certified Trainer
• Microsoft Technology Associate: Python
• Microsoft Office Expert & Specialist: Excel, Access
• Microsoft #HowWeExcel Contest Winner
Personal:
• Met the Wife on Craigslist
• Enjoys Pineapple on his Pizza
Click to edit
master title
style
SESSION
OBJECTIVES
• Convince you why
Power Query (M)
should be on every
resume.
• Have fun.
MAKE IT FEEL FAMILIAR.
BEFORE IT FEELS FOREIGN.
Click to edit
master title
style
PRIMITIVE
VALUES
Type Example
binary #binary("AQID")
date #date(2018,7,10)
time #time(18,30,0)
datetime #datetime(2018,7,10,18,30,0)
datetimezone #datetimezone(2018,7,10,18,30,0,0,6)
duration #duration(1,0,0,0)
logical true and false
null null
number 0, 1, -1, 1.5
text “hello, world”
Click to edit
master title
style
STRUCTURED
VALUES
Type Example
list {“foo”, “bar”, 10}
record [a = 10, b = 20]
table #table({“Animal”}, {{“Cat”},{“Dog”}})
let
Source = “Hello, World!”
in
Source
Power Query M’s let expression stores a set of named values called variables. Each variable has a unique
name called an identifier.
In the above let expression – the variable Source stores the primitive text value “Hello, World!”. The final
expression is evaluated in the identifier titled Source.
let
in
let
Source =
in
let
Source = “Hello, World!”
in
let
Source = "Hello, World",
#"Something Else" = "Keepin' It",
Val = 100,
#"Struct List" = {Source, #"Something Else", Val},
#"List – Index" = #"Struct List"{2}, // 0 Based Index
#"Numbered List - 0 to 100" = {0..#"List – Index"},
#"Table With Meta" = Table.FromList(#"Numbered List - 0 to 100", Splitter.SplitByNothing(), type table [Index = Int64.Type], null, ExtraValues.Error),
#"Each Loop with ASCII Number" = Table.AddColumn(#"Table With Meta", "ASCII", each Character.FromNumber([Index]), type text),
#"ASCII Column and Row" = #"Each Loop with ASCII Number"[ASCII]{97},
#"Alphabetical List - a to z" = {#"ASCII Column and Row".."z"}
in
#"Alphabetical List - a to z"
In the above let expression – the identifiers enclosed in #” “, denote the use of a special character (space) or
number for the variables identifier. Starting from the beginning of the expression we begin with primitive
values, introduce lists { }, positional index operator {2}, list sequences for numbers {0..100}, for each list
item additional column transformations, lookup and positional index operators [Column1]{2} and the use of
alphabetical list sequences {“a”..”z”}.
Full Solution: Familiar Feeling
To view the available Power Query M functions use the formula =#shared to view as structured records or
=Record.ToTable(#shared) to cast the records into a structured table format.
=#shared
WE CAN REBUILD IT.
WE HAVE THE TECHNOLOGY.
BETTER THAN IT WAS BEFORE.
BETTER. STRONGER. FASTER.
THE SIX MILLION DOLLAR QUERY.
let
Source = Excel.Workbook(Web.Contents("https://www.ers.usda.gov/webdocs/DataFiles/48747/Unemployment.xls"), null, true),
#"Unemployment Med HH Inc_Sheet" = Source{[Name="Unemployment Med HH Inc"]}[Data],
// Extract the previous identifier's Column1 as a list. Find the position of the text "FIPStxt", its first occurence while ignoring case sensitivity
#"Find Position" = Table.Skip(
#"Unemployment Med HH Inc_Sheet",
List.PositionOf(
#"Unemployment Med HH Inc_Sheet"[Column1], "FIPStxt", 1, Comparer.OrdinalIgnoreCase
)
),
#"Promoted Headers" = Table.PromoteHeaders(#"Find Position", [PromoteAllScalars=true]),
/*
Clean each item in Column Names.
The use of a underscore avoids the hardcoding of individual column headers and instead transforms each item in the collection
We used a Replacer to ReplaceText of underscores to spaces in our headers, this function is wrapped with a Text.Proper to standardize all column headers
*/
#"Clean Headers" = Table.TransformColumnNames(
#"Promoted Headers",
each
Text.Proper(
Replacer.ReplaceText( _ , "_", " ")
)
),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Clean Headers", {"Fipstxt", "State", "Area Name"}, "Attribute", "Value"),
// Rename the auto generated Attribute.2 Column Header to Year. This step avoids and unnnecessary Table.RenameColumns function
#"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Attribute.1", "Year"}),
#"Pivoted Column" = Table.Pivot(#"Split Column by Delimiter", List.Distinct(#"Split Column by Delimiter"[Attribute.1]), "Attribute.1", "Value", List.Count),
#"Changed Type" = Table.TransformColumnTypes(#"Pivoted Column",{{"Fipstxt", type text}, {"State", type text}, {"Area Name", type text}, {"Year", Int64.Type}, {"Civilian Labor Force", Int64.Type}, {"Employed", Int64.Type}, {"Unemployed", Int64.Type},
{"Unemployment Rate", Int64.Type}, {"Median Household Income", Int64.Type}, {"Med Hh Income Percent Of State Total", Int64.Type}, {"Rural Urban Continuum Code", Int64.Type}, {"Urban Influence Code", Int64.Type}, {"Metro", Int64.Type}})
in
#"Changed Type"
In the above let expression – we introduce future proofing the header row indicator of "FIPStxt“ in our
dataset and ignoring case sensitivity. Transforming our column names with an each loop we utilize the
underscore character to iterate thru each item in our column headers collection.
Full Solution: Six Million Dollar Query
NoSQLNO. NOT THAT KIND.
Query Folding
One of the most powerful capabilities of Power Query and the M Language is Query Folding
(also referred to as query delegation, and predicate push-down). Query Folding allows the M
Engine to push the transformations expressed in an M query to the source, in the source's
native query language, resulting in more efficient data processing.
Data sources will support different levels of query capabilities. To provide a consistent data
transformation experience, the M engine compensates (i.e. does the processing locally) for
transformations that cannot be sent to the source. It is the Data Connector's responsibility to
report its capabilities to the engine, carving off the transformations it can handle, generating
the appropriate query syntax, and letting the M Engine handle the remaining work.
(Source: Microsoft Docs)
Full Solution: Query Folding PowerPlatformSummit
Custom Column Name Transition Function: fxColumnNamesTransition
ROADMAPS?...
WHERE WE’RE GOING,
WE DON’T NEED ROADMAPS.
THE FUTURE IS OURS TO WRITE.
IF YOU WANT YOUR SERVICE TO BE A HIT.
MAKE SURE IT WORKS WITH EXCEL.
Oct-11 SQL Azure Labs
Feb-13 Excel Add-In
Jul-13 Excel (Natively)
Dec-14 Power BI
Apr-17 Azure Analysis
Services
Mar-18 Flow
Aug-17 PowerApps
Nov-18 Dataflows
Feb-19 SSIS
May-19 Azure Data Factory
May-19 Excel (Mac)
FLOW
PowerApps
Azure Analysis Services - 1400
Power BI service
VISUAL STUDIO
THE FUTURE
M-DBA (Highly Specialized in Writing Optimized M Syntax and Building Custom Connectors)
Intellisense (DONE)
Seamless Integration Across All Offerings (Working Toward a Unified Experience)
SSIS and Azure Data Factory Integration (DONE… or in Preview)
Microsoft Access (WHY NOT?)
Excel for Mac (DONE)
Excel Online (Crystal Ball Prediction)
Version Control (GitHub)
Standalone Product (WHY NOT?)
RESOURCES
Power Query Language Specification Guide
https://docs.microsoft.com/en-us/powerquery-m/power-query-m-language-specification
Collect, Combine, and Transform Data Using Power Query in Excel and Power BI
https://www.amazon.com/Collect-Combine-Transform-Business-Skills/dp/1509307958
M Is for (Data) Monkey: A Guide to the M Language in Excel Power Query
https://www.amazon.com/Data-Monkey-Guide-Language-Excel/dp/1615470344/
Excel 2016: Get & Transform Data (Power Query)
https://www.lynda.com/Excel-tutorials/About-Get-Transform/608994/645967-4.html
CLOSING REMARKS
IT’S NOT ABOUT WHAT YOU KNOW.
IT’S ABOUT WHAT YOU KNOW IS POSSIBLE.
QUESTIONS?
SUGGESTIONS
AM I CRAZY?!
Click to edit
master title
style
Thank you for
attending!
Please complete your
survey
Alex Power[s] BI
@notaboutthecell
/in/alexmpowers

More Related Content

What's hot

Sql practise for beginners
Sql practise for beginnersSql practise for beginners
Sql practise for beginnersISsoft
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQLMahir Haque
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)Nalina Kumari
 
Tip: Data Scoring: Convert data with XQuery
Tip: Data Scoring: Convert data with XQueryTip: Data Scoring: Convert data with XQuery
Tip: Data Scoring: Convert data with XQueryGeert Josten
 
Intro to tsql unit 7
Intro to tsql   unit 7Intro to tsql   unit 7
Intro to tsql unit 7Syed Asrarali
 
BP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @FormulaBP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @FormulaKathy Brown
 
Sql ch 12 - creating database
Sql ch 12 - creating databaseSql ch 12 - creating database
Sql ch 12 - creating databaseMukesh Tekwani
 
Sql Basics | Edureka
Sql Basics | EdurekaSql Basics | Edureka
Sql Basics | EdurekaEdureka!
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developerAhsan Kabir
 

What's hot (20)

Sql Basics And Advanced
Sql Basics And AdvancedSql Basics And Advanced
Sql Basics And Advanced
 
Sql wksht-3
Sql wksht-3Sql wksht-3
Sql wksht-3
 
Sql practise for beginners
Sql practise for beginnersSql practise for beginners
Sql practise for beginners
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Extensible Data Modeling
Extensible Data ModelingExtensible Data Modeling
Extensible Data Modeling
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
 
BIS05 Introduction to SQL
BIS05 Introduction to SQLBIS05 Introduction to SQL
BIS05 Introduction to SQL
 
Sql ch 5
Sql ch 5Sql ch 5
Sql ch 5
 
Tip: Data Scoring: Convert data with XQuery
Tip: Data Scoring: Convert data with XQueryTip: Data Scoring: Convert data with XQuery
Tip: Data Scoring: Convert data with XQuery
 
Sql basics
Sql  basicsSql  basics
Sql basics
 
Sql wksht-2
Sql wksht-2Sql wksht-2
Sql wksht-2
 
Intro to tsql unit 7
Intro to tsql   unit 7Intro to tsql   unit 7
Intro to tsql unit 7
 
Sql
SqlSql
Sql
 
Sql wksht-6
Sql wksht-6Sql wksht-6
Sql wksht-6
 
BP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @FormulaBP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @Formula
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Sql ch 12 - creating database
Sql ch 12 - creating databaseSql ch 12 - creating database
Sql ch 12 - creating database
 
Sql Basics | Edureka
Sql Basics | EdurekaSql Basics | Edureka
Sql Basics | Edureka
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
 
Sql wksht-1
Sql wksht-1Sql wksht-1
Sql wksht-1
 

Similar to Power Query M Fundamentals

What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?ukdpe
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewEric Nelson
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBantoinegirbal
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introductionantoinegirbal
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020Thodoris Bais
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...NoSQLmatters
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...Andrew Lamb
 
JakartaData-JCon.pptx
JakartaData-JCon.pptxJakartaData-JCon.pptx
JakartaData-JCon.pptxEmilyJiang23
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.pptMARasheed3
 
Spark with Elasticsearch
Spark with ElasticsearchSpark with Elasticsearch
Spark with ElasticsearchHolden Karau
 
Lecture05sql 110406195130-phpapp02
Lecture05sql 110406195130-phpapp02Lecture05sql 110406195130-phpapp02
Lecture05sql 110406195130-phpapp02Lalit009kumar
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsModern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsMike North
 
Sql saturday 829_decalogo_powerbi
Sql saturday 829_decalogo_powerbiSql saturday 829_decalogo_powerbi
Sql saturday 829_decalogo_powerbiLorenzo Vercellati
 
Intro to SQL by Google's Software Engineer
Intro to SQL by Google's Software EngineerIntro to SQL by Google's Software Engineer
Intro to SQL by Google's Software EngineerProduct School
 

Similar to Power Query M Fundamentals (20)

What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
 
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
A Rusty introduction to Apache Arrow and how it applies to a  time series dat...A Rusty introduction to Apache Arrow and how it applies to a  time series dat...
A Rusty introduction to Apache Arrow and how it applies to a time series dat...
 
JakartaData-JCon.pptx
JakartaData-JCon.pptxJakartaData-JCon.pptx
JakartaData-JCon.pptx
 
Sql server lab_2
Sql server lab_2Sql server lab_2
Sql server lab_2
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
 
Spark with Elasticsearch
Spark with ElasticsearchSpark with Elasticsearch
Spark with Elasticsearch
 
Lecture05sql 110406195130-phpapp02
Lecture05sql 110406195130-phpapp02Lecture05sql 110406195130-phpapp02
Lecture05sql 110406195130-phpapp02
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsModern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.js
 
Sql saturday 829_decalogo_powerbi
Sql saturday 829_decalogo_powerbiSql saturday 829_decalogo_powerbi
Sql saturday 829_decalogo_powerbi
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Intro to SQL by Google's Software Engineer
Intro to SQL by Google's Software EngineerIntro to SQL by Google's Software Engineer
Intro to SQL by Google's Software Engineer
 
Intake 37 linq3
Intake 37 linq3Intake 37 linq3
Intake 37 linq3
 
12 SQL
12 SQL12 SQL
12 SQL
 
12 SQL
12 SQL12 SQL
12 SQL
 
Physical Design and Development
Physical Design and DevelopmentPhysical Design and Development
Physical Design and Development
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 

Recently uploaded (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 

Power Query M Fundamentals

  • 1.
  • 2. Power Query M? (Informally known as "M") The Power Query Formula Language is a powerful query language optimized for building queries that mashup data. It's a functional, case sensitive language. For computer language theorists: Power Query is a mostly pure, higher-order, dynamically typed, partially lazy, functional language. You can create a variety of data mashup queries from simple to advanced scenarios. (Source: MSDN)
  • 3. Power Query?! (Data Connectivity and Preparation) Power Query enables business users to seamlessly access data stored in hundreds of data sources and reshape it to fit their needs, with an easy to use, engaging and no-code user experience. Data Connectors: (Source: Office Support) Access Database2 Hadoop File (HDFS) Microsoft Azure Table Storage PostgreSQL Database Text Active Directory IBM DB2 Database Microsoft Exchange SharePoint List CSV Excel Microsoft Azure HDInsight MySQL Database SQL Server Database Web Page Facebook Microsoft Azure Marketplace OData Feed Sybase Database XML Folder Microsoft Azure SQL Database Oracle Database Teradata Database And More…
  • 5. Alex M PowersPremier Field Engineer – Data & AI @ Microsoft Co-Organizer St Louis Power BI User Group #STLPBIUG Professional: • Microsoft Certified Solutions Expert: Data Management and Analytics • Microsoft Certified Solutions Associate: BI Reporting (Excel, Power BI) • Microsoft Certified Associate: Azure AI Engineer • Microsoft Certified Trainer • Microsoft Technology Associate: Python • Microsoft Office Expert & Specialist: Excel, Access • Microsoft #HowWeExcel Contest Winner Personal: • Met the Wife on Craigslist • Enjoys Pineapple on his Pizza
  • 6. Click to edit master title style SESSION OBJECTIVES • Convince you why Power Query (M) should be on every resume. • Have fun.
  • 7. MAKE IT FEEL FAMILIAR. BEFORE IT FEELS FOREIGN.
  • 8. Click to edit master title style PRIMITIVE VALUES Type Example binary #binary("AQID") date #date(2018,7,10) time #time(18,30,0) datetime #datetime(2018,7,10,18,30,0) datetimezone #datetimezone(2018,7,10,18,30,0,0,6) duration #duration(1,0,0,0) logical true and false null null number 0, 1, -1, 1.5 text “hello, world”
  • 9. Click to edit master title style STRUCTURED VALUES Type Example list {“foo”, “bar”, 10} record [a = 10, b = 20] table #table({“Animal”}, {{“Cat”},{“Dog”}})
  • 10. let Source = “Hello, World!” in Source Power Query M’s let expression stores a set of named values called variables. Each variable has a unique name called an identifier. In the above let expression – the variable Source stores the primitive text value “Hello, World!”. The final expression is evaluated in the identifier titled Source. let in let Source = in let Source = “Hello, World!” in
  • 11. let Source = "Hello, World", #"Something Else" = "Keepin' It", Val = 100, #"Struct List" = {Source, #"Something Else", Val}, #"List – Index" = #"Struct List"{2}, // 0 Based Index #"Numbered List - 0 to 100" = {0..#"List – Index"}, #"Table With Meta" = Table.FromList(#"Numbered List - 0 to 100", Splitter.SplitByNothing(), type table [Index = Int64.Type], null, ExtraValues.Error), #"Each Loop with ASCII Number" = Table.AddColumn(#"Table With Meta", "ASCII", each Character.FromNumber([Index]), type text), #"ASCII Column and Row" = #"Each Loop with ASCII Number"[ASCII]{97}, #"Alphabetical List - a to z" = {#"ASCII Column and Row".."z"} in #"Alphabetical List - a to z" In the above let expression – the identifiers enclosed in #” “, denote the use of a special character (space) or number for the variables identifier. Starting from the beginning of the expression we begin with primitive values, introduce lists { }, positional index operator {2}, list sequences for numbers {0..100}, for each list item additional column transformations, lookup and positional index operators [Column1]{2} and the use of alphabetical list sequences {“a”..”z”}. Full Solution: Familiar Feeling
  • 12. To view the available Power Query M functions use the formula =#shared to view as structured records or =Record.ToTable(#shared) to cast the records into a structured table format. =#shared
  • 13. WE CAN REBUILD IT. WE HAVE THE TECHNOLOGY. BETTER THAN IT WAS BEFORE. BETTER. STRONGER. FASTER. THE SIX MILLION DOLLAR QUERY.
  • 14. let Source = Excel.Workbook(Web.Contents("https://www.ers.usda.gov/webdocs/DataFiles/48747/Unemployment.xls"), null, true), #"Unemployment Med HH Inc_Sheet" = Source{[Name="Unemployment Med HH Inc"]}[Data], // Extract the previous identifier's Column1 as a list. Find the position of the text "FIPStxt", its first occurence while ignoring case sensitivity #"Find Position" = Table.Skip( #"Unemployment Med HH Inc_Sheet", List.PositionOf( #"Unemployment Med HH Inc_Sheet"[Column1], "FIPStxt", 1, Comparer.OrdinalIgnoreCase ) ), #"Promoted Headers" = Table.PromoteHeaders(#"Find Position", [PromoteAllScalars=true]), /* Clean each item in Column Names. The use of a underscore avoids the hardcoding of individual column headers and instead transforms each item in the collection We used a Replacer to ReplaceText of underscores to spaces in our headers, this function is wrapped with a Text.Proper to standardize all column headers */ #"Clean Headers" = Table.TransformColumnNames( #"Promoted Headers", each Text.Proper( Replacer.ReplaceText( _ , "_", " ") ) ), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Clean Headers", {"Fipstxt", "State", "Area Name"}, "Attribute", "Value"), // Rename the auto generated Attribute.2 Column Header to Year. This step avoids and unnnecessary Table.RenameColumns function #"Split Column by Delimiter" = Table.SplitColumn(#"Unpivoted Other Columns", "Attribute", Splitter.SplitTextByEachDelimiter({" "}, QuoteStyle.Csv, true), {"Attribute.1", "Year"}), #"Pivoted Column" = Table.Pivot(#"Split Column by Delimiter", List.Distinct(#"Split Column by Delimiter"[Attribute.1]), "Attribute.1", "Value", List.Count), #"Changed Type" = Table.TransformColumnTypes(#"Pivoted Column",{{"Fipstxt", type text}, {"State", type text}, {"Area Name", type text}, {"Year", Int64.Type}, {"Civilian Labor Force", Int64.Type}, {"Employed", Int64.Type}, {"Unemployed", Int64.Type}, {"Unemployment Rate", Int64.Type}, {"Median Household Income", Int64.Type}, {"Med Hh Income Percent Of State Total", Int64.Type}, {"Rural Urban Continuum Code", Int64.Type}, {"Urban Influence Code", Int64.Type}, {"Metro", Int64.Type}}) in #"Changed Type" In the above let expression – we introduce future proofing the header row indicator of "FIPStxt“ in our dataset and ignoring case sensitivity. Transforming our column names with an each loop we utilize the underscore character to iterate thru each item in our column headers collection. Full Solution: Six Million Dollar Query
  • 16. Query Folding One of the most powerful capabilities of Power Query and the M Language is Query Folding (also referred to as query delegation, and predicate push-down). Query Folding allows the M Engine to push the transformations expressed in an M query to the source, in the source's native query language, resulting in more efficient data processing. Data sources will support different levels of query capabilities. To provide a consistent data transformation experience, the M engine compensates (i.e. does the processing locally) for transformations that cannot be sent to the source. It is the Data Connector's responsibility to report its capabilities to the engine, carving off the transformations it can handle, generating the appropriate query syntax, and letting the M Engine handle the remaining work. (Source: Microsoft Docs)
  • 17. Full Solution: Query Folding PowerPlatformSummit Custom Column Name Transition Function: fxColumnNamesTransition
  • 18. ROADMAPS?... WHERE WE’RE GOING, WE DON’T NEED ROADMAPS. THE FUTURE IS OURS TO WRITE.
  • 19. IF YOU WANT YOUR SERVICE TO BE A HIT. MAKE SURE IT WORKS WITH EXCEL. Oct-11 SQL Azure Labs Feb-13 Excel Add-In Jul-13 Excel (Natively) Dec-14 Power BI Apr-17 Azure Analysis Services Mar-18 Flow Aug-17 PowerApps Nov-18 Dataflows Feb-19 SSIS May-19 Azure Data Factory May-19 Excel (Mac)
  • 20. FLOW
  • 25. THE FUTURE M-DBA (Highly Specialized in Writing Optimized M Syntax and Building Custom Connectors) Intellisense (DONE) Seamless Integration Across All Offerings (Working Toward a Unified Experience) SSIS and Azure Data Factory Integration (DONE… or in Preview) Microsoft Access (WHY NOT?) Excel for Mac (DONE) Excel Online (Crystal Ball Prediction) Version Control (GitHub) Standalone Product (WHY NOT?)
  • 26. RESOURCES Power Query Language Specification Guide https://docs.microsoft.com/en-us/powerquery-m/power-query-m-language-specification Collect, Combine, and Transform Data Using Power Query in Excel and Power BI https://www.amazon.com/Collect-Combine-Transform-Business-Skills/dp/1509307958 M Is for (Data) Monkey: A Guide to the M Language in Excel Power Query https://www.amazon.com/Data-Monkey-Guide-Language-Excel/dp/1615470344/ Excel 2016: Get & Transform Data (Power Query) https://www.lynda.com/Excel-tutorials/About-Get-Transform/608994/645967-4.html
  • 27. CLOSING REMARKS IT’S NOT ABOUT WHAT YOU KNOW. IT’S ABOUT WHAT YOU KNOW IS POSSIBLE.
  • 29. Click to edit master title style Thank you for attending! Please complete your survey