SlideShare a Scribd company logo
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 Database 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…
POWER QUERY
FOR POWER BI
AND BEYOND.
A “M”ind Bending Experience.
ALEX M POWERS
Microsoft Certified Solutions Associate: BI Reporting (Excel, Power BI)
Microsoft Technology Associate: Python (Introduction to Programming)
Microsoft Office Expert: Excel 2013, Excel 2010
Microsoft Office Specialist: Access 2013, Excel 2010
Microsoft #HowWeExcel Contest Winner
Co-Organizer of the St Louis Power BI User Group #STLPBIUG
Millennial Whisperer and Trainer | It’s Not About The Cell LLC: itsnotaboutthecell.com
Estimates that 95% of Cloud Storage is Cat Photos
Enjoys Pineapple On His Pizza
MAKE IT FEEL FAMILIAR.
BEFORE IT FEELS FOREIGN.
Hello, World!
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”
STRUCTURED VALUES
Type Example
list {“foo”, “bar”, 10}
record [a = 10, b = 20]
table #table({“Animal”}, {{“Cat”},{“Dog”}})
M SYNTAX
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
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 variable’s 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
UP IS DOWN.
THE UPSIDE DOWN.
DOWNISUP.
let
Source = #table(
type table [Vendor=Text.Type, State=Text.Type, Sales=Number.Type, #"Total Amount"=Number.Type],
{
{"Contoso","MO",150,4013.116648},
…
}
),
#"Filter: non null" = Table.SelectRows(Source, each ([State] <> null)),
// Vendor ASC, Sales DESC
#"Sort Columns" = Table.Sort(#"Filter: non null",{{"Vendor", Order.Ascending}, {"Sales", Order.Descending}}),
// Largest Sales of Each
#"Remove Duplicate Vendors" = Table.Distinct(#"Sort Columns", {"Vendor"}),
#"Removed Other Columns" = Table.SelectColumns(Source,{"Vendor", "Sales", "Total Amount"}),
#"Merged Queries" = Table.NestedJoin(#"Removed Other Columns",{"Vendor"},#"Remove Duplicate Vendors",{"Vendor"},"Clean States",JoinKind.Inner),
#"Expanded Clean States" = Table.ExpandTableColumn(#"Merged Queries", "Clean States", {"State"}, {"State"})
in
#"Expanded Clean States"
In the above let expression – we debunk the notion that M is a top to bottom evaluation instead a series of
parameters that can be recalled at various stages during the transformation. In the identifier #“Removed
Other Columns” we reference the first identifier Source. In the identifier #”Merge Queries” we perform a
self merge to begin with and edit the M formula’s second table reference to point to the #”Removed
Duplicate Vendors” identifier.
Full Solution: Down Is Up
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
Nov-18 DataFlows
Feb-19 SSIS
Aug-17 PowerApps
FLOW
PowerApps
SSAS / AAS – 1400
Power BI Service
VISUAL STUDIO
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
CUSTOM CONNECTORS
• Visual Studio Extensions
• Power Query SDK
• Auto Deploy
• Resources
• Getting Started with Data Connectors
• A Deep Dive into the M Language: Creating a Custom Connector
• MSDN: Connector Development
• Example
• OpenWeatherMap
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)
Microsoft Access (WHY NOT?)
Excel for Mac (In Development)
Excel Online (Crystal Ball Prediction)
Version Control (GitHub)
Standalone Product (WHY NOT?)
CLOSING REMARKS
IT’S NOT ABOUT WHAT YOU KNOW.
IT’S ABOUT WHAT YOU KNOW IS POSSIBLE.
IT’S NOT ABOUT THE CELL
www.itsnotaboutthecell.com
QUESTIONS?
YOU THINK I’M CRAZY?!
Connect Online
@notaboutthecell
/in/alexmpowers
It’s Not About The Cell

More Related Content

What's hot

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
Geert Josten
 
Sql wksht-3
Sql wksht-3Sql wksht-3
Sql wksht-3
Mukesh Tekwani
 
Sql practise for beginners
Sql practise for beginnersSql practise for beginners
Sql practise for beginners
ISsoft
 
Extensible Data Modeling
Extensible Data ModelingExtensible Data Modeling
Extensible Data Modeling
Karwin Software Solutions LLC
 
BIS05 Introduction to SQL
BIS05 Introduction to SQLBIS05 Introduction to SQL
BIS05 Introduction to SQL
Prithwis Mukerjee
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
Mahir Haque
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
Nalina Kumari
 
Sql ch 5
Sql ch 5Sql ch 5
Sql ch 5
Mukesh Tekwani
 
Sql
SqlSql
Sql wksht-2
Sql wksht-2Sql wksht-2
Sql wksht-2
Mukesh Tekwani
 
Intro to tsql unit 7
Intro to tsql   unit 7Intro to tsql   unit 7
Intro to tsql unit 7
Syed Asrarali
 
BP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @FormulaBP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @Formula
Kathy Brown
 
Sql ch 12 - creating database
Sql ch 12 - creating databaseSql ch 12 - creating database
Sql ch 12 - creating database
Mukesh Tekwani
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
Ahsan Kabir
 
Sql wksht-6
Sql wksht-6Sql wksht-6
Sql wksht-6
Mukesh Tekwani
 
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
Product School
 
Sql Basics | Edureka
Sql Basics | EdurekaSql Basics | Edureka
Sql Basics | Edureka
Edureka!
 
Internet Environment
Internet  EnvironmentInternet  Environment
Internet Environment
guest8fdbdd
 
Microsoft Excel and RS-232 peripherals protocol communication DDE
Microsoft Excel and RS-232 peripherals protocol communication DDEMicrosoft Excel and RS-232 peripherals protocol communication DDE
Microsoft Excel and RS-232 peripherals protocol communication DDE
topomax
 
Sql wksht-1
Sql wksht-1Sql wksht-1
Sql wksht-1
Mukesh Tekwani
 

What's hot (20)

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 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
 
Extensible Data Modeling
Extensible Data ModelingExtensible Data Modeling
Extensible Data Modeling
 
BIS05 Introduction to SQL
BIS05 Introduction to SQLBIS05 Introduction to SQL
BIS05 Introduction to SQL
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
 
Sql ch 5
Sql ch 5Sql ch 5
Sql ch 5
 
Sql
SqlSql
Sql
 
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
 
BP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @FormulaBP208 Fabulous Feats with @Formula
BP208 Fabulous Feats with @Formula
 
Sql ch 12 - creating database
Sql ch 12 - creating databaseSql ch 12 - creating database
Sql ch 12 - creating database
 
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-6
Sql wksht-6Sql wksht-6
Sql wksht-6
 
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
 
Sql Basics | Edureka
Sql Basics | EdurekaSql Basics | Edureka
Sql Basics | Edureka
 
Internet Environment
Internet  EnvironmentInternet  Environment
Internet Environment
 
Microsoft Excel and RS-232 peripherals protocol communication DDE
Microsoft Excel and RS-232 peripherals protocol communication DDEMicrosoft Excel and RS-232 peripherals protocol communication DDE
Microsoft Excel and RS-232 peripherals protocol communication DDE
 
Sql wksht-1
Sql wksht-1Sql wksht-1
Sql wksht-1
 

Similar to A "M"ind Bending Experience. Power Query for Power BI and Beyond.

E-R diagram & SQL
E-R diagram & SQLE-R diagram & SQL
E-R diagram & SQL
Abdullah Almasud
 
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
Serdar Basegmez
 
"If I knew then what I know now"
"If I knew then what I know now""If I knew then what I know now"
"If I knew then what I know now"
Visual Resources Association
 
Web app development_database_design_10
Web app development_database_design_10Web app development_database_design_10
Web app development_database_design_10
Hassen Poreya
 
Types Working for You, Not Against You
Types Working for You, Not Against YouTypes Working for You, Not Against You
Types Working for You, Not Against You
C4Media
 
Keerty rdbms sql
Keerty rdbms sqlKeerty rdbms sql
Keerty rdbms sql
Keerty Smile
 
Road to Power Query NINJA – 1st STEP
Road to Power Query NINJA – 1st STEP Road to Power Query NINJA – 1st STEP
Road to Power Query NINJA – 1st STEP
Takeshi Kagata
 
Data Analysis with R (combined slides)
Data Analysis with R (combined slides)Data Analysis with R (combined slides)
Data Analysis with R (combined slides)
Guy Lebanon
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
Eric Nelson
 
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
 
External domain-specific languages
External domain-specific languagesExternal domain-specific languages
External domain-specific languages
Mikhail Barash
 
Big Data Analytics Part2
Big Data Analytics Part2Big Data Analytics Part2
Big Data Analytics Part2
Sreedhar Chowdam
 
Ssrs expressions
Ssrs expressionsSsrs expressions
Ssrs expressions
nareshbidevl
 
Spark with Elasticsearch
Spark with ElasticsearchSpark with Elasticsearch
Spark with Elasticsearch
Holden Karau
 
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP TechnologyFnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
fntsofttech
 
Sql server lab_2
Sql server lab_2Sql server lab_2
Sql server lab_2
vijay venkatash
 
Intake 37 linq3
Intake 37 linq3Intake 37 linq3
Intake 37 linq3
Mahmoud Ouf
 
Get started with R lang
Get started with R langGet started with R lang
Get started with R lang
senthil0809
 
Advanced Internationalization with Rails
Advanced Internationalization with RailsAdvanced Internationalization with Rails
Advanced Internationalization with Rails
Clinton Dreisbach
 
Sql saturday 829_decalogo_powerbi
Sql saturday 829_decalogo_powerbiSql saturday 829_decalogo_powerbi
Sql saturday 829_decalogo_powerbi
Lorenzo Vercellati
 

Similar to A "M"ind Bending Experience. Power Query for Power BI and Beyond. (20)

E-R diagram & SQL
E-R diagram & SQLE-R diagram & SQL
E-R diagram & SQL
 
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
ICONUK 2016: REST Assured, Freeing Your Domino Data Has Never Been That Easy!
 
"If I knew then what I know now"
"If I knew then what I know now""If I knew then what I know now"
"If I knew then what I know now"
 
Web app development_database_design_10
Web app development_database_design_10Web app development_database_design_10
Web app development_database_design_10
 
Types Working for You, Not Against You
Types Working for You, Not Against YouTypes Working for You, Not Against You
Types Working for You, Not Against You
 
Keerty rdbms sql
Keerty rdbms sqlKeerty rdbms sql
Keerty rdbms sql
 
Road to Power Query NINJA – 1st STEP
Road to Power Query NINJA – 1st STEP Road to Power Query NINJA – 1st STEP
Road to Power Query NINJA – 1st STEP
 
Data Analysis with R (combined slides)
Data Analysis with R (combined slides)Data Analysis with R (combined slides)
Data Analysis with R (combined slides)
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
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?
 
External domain-specific languages
External domain-specific languagesExternal domain-specific languages
External domain-specific languages
 
Big Data Analytics Part2
Big Data Analytics Part2Big Data Analytics Part2
Big Data Analytics Part2
 
Ssrs expressions
Ssrs expressionsSsrs expressions
Ssrs expressions
 
Spark with Elasticsearch
Spark with ElasticsearchSpark with Elasticsearch
Spark with Elasticsearch
 
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP TechnologyFnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
 
Sql server lab_2
Sql server lab_2Sql server lab_2
Sql server lab_2
 
Intake 37 linq3
Intake 37 linq3Intake 37 linq3
Intake 37 linq3
 
Get started with R lang
Get started with R langGet started with R lang
Get started with R lang
 
Advanced Internationalization with Rails
Advanced Internationalization with RailsAdvanced Internationalization with Rails
Advanced Internationalization with Rails
 
Sql saturday 829_decalogo_powerbi
Sql saturday 829_decalogo_powerbiSql saturday 829_decalogo_powerbi
Sql saturday 829_decalogo_powerbi
 

Recently uploaded

UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
HarisZaheer8
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Tatiana Kojar
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
LucaBarbaro3
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 

Recently uploaded (20)

UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
AWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptxAWS Cloud Cost Optimization Presentation.pptx
AWS Cloud Cost Optimization Presentation.pptx
 
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
Skybuffer AI: Advanced Conversational and Generative AI Solution on SAP Busin...
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Trusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process MiningTrusted Execution Environment for Decentralized Process Mining
Trusted Execution Environment for Decentralized Process Mining
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 

A "M"ind Bending Experience. Power Query for Power BI and Beyond.

  • 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 Database 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…
  • 4. POWER QUERY FOR POWER BI AND BEYOND. A “M”ind Bending Experience.
  • 5. ALEX M POWERS Microsoft Certified Solutions Associate: BI Reporting (Excel, Power BI) Microsoft Technology Associate: Python (Introduction to Programming) Microsoft Office Expert: Excel 2013, Excel 2010 Microsoft Office Specialist: Access 2013, Excel 2010 Microsoft #HowWeExcel Contest Winner Co-Organizer of the St Louis Power BI User Group #STLPBIUG Millennial Whisperer and Trainer | It’s Not About The Cell LLC: itsnotaboutthecell.com Estimates that 95% of Cloud Storage is Cat Photos Enjoys Pineapple On His Pizza
  • 6. MAKE IT FEEL FAMILIAR. BEFORE IT FEELS FOREIGN. Hello, World!
  • 7. 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”
  • 8. 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.
  • 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 variable’s 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
  • 15. UP IS DOWN. THE UPSIDE DOWN. DOWNISUP.
  • 16. let Source = #table( type table [Vendor=Text.Type, State=Text.Type, Sales=Number.Type, #"Total Amount"=Number.Type], { {"Contoso","MO",150,4013.116648}, … } ), #"Filter: non null" = Table.SelectRows(Source, each ([State] <> null)), // Vendor ASC, Sales DESC #"Sort Columns" = Table.Sort(#"Filter: non null",{{"Vendor", Order.Ascending}, {"Sales", Order.Descending}}), // Largest Sales of Each #"Remove Duplicate Vendors" = Table.Distinct(#"Sort Columns", {"Vendor"}), #"Removed Other Columns" = Table.SelectColumns(Source,{"Vendor", "Sales", "Total Amount"}), #"Merged Queries" = Table.NestedJoin(#"Removed Other Columns",{"Vendor"},#"Remove Duplicate Vendors",{"Vendor"},"Clean States",JoinKind.Inner), #"Expanded Clean States" = Table.ExpandTableColumn(#"Merged Queries", "Clean States", {"State"}, {"State"}) in #"Expanded Clean States" In the above let expression – we debunk the notion that M is a top to bottom evaluation instead a series of parameters that can be recalled at various stages during the transformation. In the identifier #“Removed Other Columns” we reference the first identifier Source. In the identifier #”Merge Queries” we perform a self merge to begin with and edit the M formula’s second table reference to point to the #”Removed Duplicate Vendors” identifier. Full Solution: Down Is Up
  • 17. ROADMAPS?... WHERE WE’RE GOING, WE DON’T NEED ROADMAPS. THE FUTURE IS OURS TO WRITE.
  • 18. 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 Nov-18 DataFlows Feb-19 SSIS Aug-17 PowerApps
  • 19. FLOW
  • 21. SSAS / AAS – 1400
  • 24. 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
  • 25. CUSTOM CONNECTORS • Visual Studio Extensions • Power Query SDK • Auto Deploy • Resources • Getting Started with Data Connectors • A Deep Dive into the M Language: Creating a Custom Connector • MSDN: Connector Development • Example • OpenWeatherMap
  • 26. 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) Microsoft Access (WHY NOT?) Excel for Mac (In Development) Excel Online (Crystal Ball Prediction) Version Control (GitHub) Standalone Product (WHY NOT?)
  • 27. CLOSING REMARKS IT’S NOT ABOUT WHAT YOU KNOW. IT’S ABOUT WHAT YOU KNOW IS POSSIBLE.
  • 28. IT’S NOT ABOUT THE CELL www.itsnotaboutthecell.com