HOME

TheInfoList



OR:

Power Query is an ETL tool created by
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
for data extraction, loading and transformation, and is used to retrieve data from sources, process it, and load them into one or more target systems. Power Query is available in several variations within the
Microsoft Power Platform Microsoft Power Platform is a collection of low-code development tools that allows users to build custom business applications, automate workflows, and analyze data. It also offers integration with GitHub, Microsoft Azure, Microsoft Dynamics 365 ...
, and is used for
business intelligence Business intelligence (BI) consists of strategies, methodologies, and technologies used by enterprises for data analysis and management of business information. Common functions of BI technologies include Financial reporting, reporting, online an ...
on fully or partially self-service platforms. It is found in software such as Excel, Power BI, Analysis Services,
Dataverse The Dataverse is an open source web application to share, preserve, cite, explore and analyze research data. Researchers, data authors, publishers, data distributors, and affiliated institutions all receive appropriate credit via a data citation ...
,
Power Apps Microsoft Power Platform is a collection of low-code development tools that allows users to build custom business applications, automate workflows, and analyze data. It also offers integration with GitHub, Microsoft Azure, Microsoft Dynamics 365 ...
, Azure Data Factory, SSIS, Dynamics 365, and in cloud services such as Microsoft Dataflows, including Power BI Dataflow used with the online Power BI Service or the somewhat more generic version of Microsoft Dataflow used with Power Automate. ETL is closely related to
data modeling Data modeling in software engineering is the process of creating a data model for an information system by applying certain formal techniques. It may be applied as part of broader Model-driven engineering (MDE) concept. Overview Data modeli ...
, and for transformation, Power Query can be used to develop a logical data model in those cases where the data does not already have one, or where there is a need to further develop the
data model A data model is an abstract model that organizes elements of data and standardizes how they relate to one another and to the properties of real-world entities. For instance, a data model may specify that the data element representing a car be ...
.


History

Power Query was first announced in 2011 under the codename "Data Explorer" as part of Azure SQL Labs. In 2013, in order to expand on the self-service
business intelligence Business intelligence (BI) consists of strategies, methodologies, and technologies used by enterprises for data analysis and management of business information. Common functions of BI technologies include Financial reporting, reporting, online an ...
capabilities of Microsoft Excel, the project was redesigned to be packaged as an add-in Excel and was renamed "Data Explorer Preview for Excel", and was made available for Excel 2010 and Excel 2013. In July 2013 the add-in was removed from preview and renamed to "Power Query". Monthly updates for the add-in were released until 2016, when Power Query was included in Excel natively. In Excel 2016, the function was renamed "Get & Transform" for a short time, but has since been changed back to Power Query. In April 2017, Power Query was made available in Microsoft Analysis Services. With the launch of the Common Data Service in March 2018, Power Query was included as its main data import tool.


M Formula language

Power Query is built on what was then a new
query language A query language, also known as data query language or database query language (DQL), is a computer language used to make queries in databases and information systems. In database systems, query languages rely on strict theory to retrieve informa ...
called M. It is a mashup language (hence the letter M) designed to create queries that mix together data. It is similar to the F# programming language, and according to Microsoft it is a "mostly pure, higher-order, dynamically typed, partially lazy, functional language." The M language is case-sensitive. Much of the user interaction with Power Query can be done via
graphical user interfaces A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
with wizards, and this can be used for many common or basic tasks. It is also possible to use the advanced editing mode where the developer can write in the M formula language; this gives greater expressive power, more possibilities, and can also be used to change the code generated by the graphical wizards.


Let expression

User queries are typically written with a top level ''let'' expression. The ''let'' expression contains a list of comma-separated named reference (variables) bindings and an ''in'' expression which is what the ''let'' expression evaluates to. The ''in'' expression can reference the variables and the variables can reference each other. Backwards and forward referencing is allowed, and self-referencing is allowed by prefixing the ''@'' on the variable. Variables are recursively evaluated as needed to evaluate the ''in'' expression. No variable is evaluated more than once.


Examples

let a = "Hello", b = "World", result = a & " " & b in result let result = Fib(5), Fib = (iteration) => if iteration = 0 or iteration = 1 then 1 else let a = @Fib(iteration - 1), b = @Fib(iteration - 2) in a + b in result


Assertions and datatypes

Variables are not typed in Power Query. Instead, an expression can have a type assertion which will evaluate to an error when the expression does not evaluate to a value compatible with the assertion. Assertions can be preceded by ''nullable'' to include null in the allowed values. {, class="wikitable" , + Datatypes/Assertions ! Name !! Description !! Datatype !! Assertion , - , number , , Assertion for integer and floating-point numbers , , , , , - , int , , Signed 32-bit integer , , , , , - , long , , Signed 64-bit integer , , , , , - , double , , IEEE 754 float , , , , , - , decimal , , 128-bit float. Same as C#'s decimal , , , , , - , time , , Time of day , , , , , - , date , , A calendar date ranging from 1 CE to 9999 CE in the Georgian Calendar , , , , , - , datetime , , A composite of the date and time datatypes , , , , , - , duration , , A measurement of elapsed time (can be negative) , , , , , - , logical , , Represents a Boolean ''true'' or ''false'' value , , , , , - , text , , A Unicode string , , , , , - , guid , , A Globally Unique Identifier (Converts to a text as needed automatically) , , , , , - , list , , An ordered list of values , , , , , - , record , , An ordered map from text to any value , , , , , - , table , , A 2D matrix where each column has a unique name and type (type not checked on table contents) , , , , , - , function , , A power query function , , , , , - , type , , Represents a datatype and may contain assertion information , , , , , - , action , , An internally used datatype , , , , , - , null , , The null singleton , , , , , - , any , , Represents all values , , , , , - , anynonnull , , Represents all values except null , , , , , - , none , , Represents no values and always fails as an assertion , , , , , - , error , , A pseudo value representing an error , , , , {{No X


Comments

Power Query supports the C block (''/* ... */'') and C line (''// ...'') comments.


DirectQuery

In Power BI, use of M-code is somewhat limited in DirectQuery, as opposed to Import which has all capabilities. This is due to the requirement that M-code in DirectQuery has to be translated from DAX into SQL and then into the data source's native query language (if it isn't SQL) upon user interaction with the data.


Query Folding

Query Folding is the ability for the Power Query steps to be transpiled into a single query at the data source (for example in Transact SQL). As such, Query Folding works like a traditional ETL process, and enables working on the data before loading. Query Folding is not always supported. Steps like filtering, selecting columns and simple SQL arithmetic are supported. Steps like creating index and appending or merging non foldable sources with foldable sources are not. Folding indicators (such as folding, not folding, might fold, opaque, unknown) might indicate up to which step a query might fold. Non-folding queries will have to be performed on the client-side. The order of queries can determine how many of the steps which get folded.


Connectors

A connector in power query is a library which enables queries to connect to a datasource. End users of Power BI can write custom connectors in the Power Query language. If a user is the owner/maintainer of the datasource technology they can request Microsoft certify their connector and include it in future releases of Power Bi after the review of the code. Connectors that are not certified can still be shared with other people who enable developer mode in Power Bi, or by Power Bi online domain administrators.


See also

*
Online analytical processing In computing, online analytical processing (OLAP) (), is an approach to quickly answer multi-dimensional analytical (MDA) queries. The term ''OLAP'' was created as a slight modification of the traditional database term online transaction proces ...
(OLAP) * Data Analysis Expressions (DAX), a complementary expression language used to query models and compute advanced measures *
Logical data model A logical data model or logical schema is a data model of a specific problem domain expressed independently of a particular database management product or storage technology (physical data model) but in terms of data structures such as relational ta ...
, hereunder
star schema In computing, the star schema or star model is the simplest style of data mart Logical schema, schema and is the approach most widely used to develop data warehouses and dimensional data marts. The star schema consists of one or more fact tables ...
with
fact table In data warehousing, a fact table consists of the measurements, metrics or Fact (data warehouse), facts of a business process. It is located at the center of a star schema or a snowflake schema surrounded by dimension tables. Where multiple fact t ...
and dimension tables


External links


What is Power Query?
- Microsoft Learn
Power Query formula language


References

Microsoft Office