Note: Power Query is known as Get & Transform in Excel 2016. Information provided here applies to both. To learn more, see Get & Transform in Excel 2016.
Power Query enhances self-service business intelligence (BI) for Excel with an intuitive experience for discovering, combining, and refining data across a wide variety of sources—including relational, structured/semi-structured, OData, Web, Hadoop, and more.
Using the Query Editor, you can aggregate one or more columns of a linked table. For example, you can aggregate the sum of order details for each order.
Aggregate a column
Follow these steps:
-
In Query Editor, select the expand icon ( ) in a column header containing a related Table link.
-
In the Table link column drop-down:
-
Click the Aggregate option.
-
Hover over an aggregate function item, such as Aggregates of UnitPrice.
-
From the aggregate function drop down, select one or more aggregate functions. For example, Sum and Average.
-
-
Click OK.
This will add a new aggregate column to the table. The new column name will be of the form <AggregateFunctionName> of <ColumnName>.
For example, Sum of Order_Details.UnitPrice and Average of Order_Details.UnitPrice.
Quick Start Example
In this Quick Start example, you'll aggregate the Order_Details column from the Northwind Orders table.
Note: This Quick Start uses the Northwind Open Data Protocol (OData) feed. An OData feed is a uniform way to expose data on the web. Similar to a web page, you access an OData feed with a url.
Follow these steps:
-
In the POWER QUERY ribbon tab, click From Other Sources > From OData Feed.
-
In the OData Feed dialog box, enter the URL for the Northwind OData feed.
http://services.odata.org/northwind/northwind.svc
-
Click OK.
-
In the Navigator pane, double click the Orders table or click Orders and click Edit Query.
-
In the Query Editor dialog box, scroll to the right and click the expand icon ( ) next to the Order_Details column.
-
In the expand column drop-down:
-
Click Aggregate.
-
Hover over Sum of UnitPrice and click the aggregate function drop down.
-
Select Sum and Average. The Sum of UnitPrice label changes to Aggregates of UnitPrice.
-
-
Click OK.
Power Query expands the Order_Details column, replacing the column with the Sum of UnitPrice and Average of UnitPrice.
No comments:
Post a Comment