Upload
saravanase
View
21
Download
0
Embed Size (px)
DESCRIPTION
PQ
Citation preview
Introduction to Power Query David Dye
Introduction to Power Query • Introduction • Introduction to Power Query • Working With Power Query
Introduction • David Dye
• [email protected] • HTTP://WWW.SQLSAFETY.COM
Introduction to Power Query
What is Power Query? • Excel add in
– Available in Excel 2013 and 2010 Professional Plus • Provides a means natively in Excel to:
– Discovering – Combining – Refining data – Merge and shape data across multiple sources – Create custom views over data – Perform data cleansing operations
• Allows access to a wide variety of data sources • The ETL tool for Excel
What is the Difference Between Power Query and PowerPivot
• Power Query can – Pull data from sources not readily available in PowerPivot
• Facebook • Hadoop • MySQL
– Inline Transformations • Provides a “Steps” view to recap transformations
– Append and Merge can take tables from different sources and present them as one
– Supports JSON when working with Web API’s
Working with Power Query
Insuring Power Query is Enabled • If Power Query is not available in the menu bar make sure
that is enabled
– Files>Options> Add-Ins Manage COM Add-Ins
• Power Query can be downloaded from http://www.microsoft.com/en-us/download/details.aspx?id=39379
Demonstration 1 Enable Power Query
Working with Power Query • Once installed the Power Query menu is
available • Provides the tools to create the data models
or sheets based on the data sources
Demonstration 2 Opening Power Query
Power Query Data Sources – Web page – Excel or CSV file – XML file – Text file – Folder – SQL Server database – Windows Azure SQL Database – Access database – Oracle database – IBM DB2 database – MySQL database – SharePoint List – OData feed – Hadoop Distributed File System (HDFS – Windows Azure Marketplace – Active Directory – Facebook
Data Sources From Web • Online Search
– Searches different sources on the internet, extranet, and intranet • Integrates with Office 365 as part of Power BI
• From Web – Enter Url of data source location
• From Other Sources – SharePoint list – OData Feed – Windows Azure Marketplace – Facebook
Demonstration 3 Online search Web source Facebook source
Importing Data • From the Power Query Menu
– Select the data source
Importing Data Cont. • Depending on the source additional
configuration will be necessary
Query Editor
Filtering Data • A filter can be applied to query results limiting
the rows – This will filter the rows that will be saved in Excel
or within a data model
Filtering Data Cont. • Columns can be removed from the result set
of the query to help shape your data
Query Properties • There are several properties that can be
configured from the Query Editor > View tab – The Query Settings button will show or hide the Query
settings tab – The Advanced Editor opens a modal window that will
show the Power Query formula for the query – The Formula bar check box will display the formula
bar when checked
Working With Query Results • There are a number of built in functions in the Query Editor
window that allows you to transform your data – Remove TOP N Rows
• Removes the top number of rows specified – Remove Columns
• Removes the column(s) selected – Sort – Replace values – Remove duplicates will remove duplicate rows from the query
result set
Group By • Allows you to apply a grouping and
aggregation on query results – Retains the original query results
Group By Cont.
Split • Provides the ability to split a single column into two or more columns • Several configuration options that allow for simple to complex parsing • Retains the original query results
Split Cont.
Merge • Allows you to combine different query results
– Acts like a SQL JOIN – Define the column(s) to match – Select whether to show non matching results
Append • Allows you to merge result sets from separate queries
together • Unlike a Merge all results are returned and you do not need
to specify a column on which to match
Demonstration 4 SQL Source and filtering Group By Split Append Merge
Power Query Formula • Power Query has its own formulas
– Informally known as “M” – More powerful than Excel – Only available from within Power Query – Full documentation and syntax can be found here
• http://office.microsoft.com/en-us/excel-help/learn-about-power-query-formulas-HA104003958.aspx
Demonstration 5 Create a calculated column Table Compare
What’s This All For??? • Power Query acts as the ETL tool providing the
ability to work with data across numerous formats and locations
• All results are opened in Excel as a pivot table • Refreshing the data will refresh the results
Save As A Data Model • Results are always opened in Excel as a pivot
table, but can also be saved as a data model • An Excel Data Model is a relational data source
composed from multiple tables inside an Excel workbook
• Within Excel, a Data Model is used transparently, providing tabular data used in PivotTables, PivotCharts, and Power View reports.
What’s Next?? • Extracting or conglomerating the data in Excel
is the first step • Working with the data natively in Excel is one
option • PowerPivot allows you to create complex
tabular data models and extends the capabilities of Excel
Demonstration 6 PowerPivot