Working on groups of rows
Until now, you have been working on individual rows. There are a lot of operations that work on the dataset as a whole. You just learned to sort the dataset, which is a starting point to implement a list of many other operations. The first and one of the most used in this category is the aggregation of data.
Aggregating data
Suppose that you have a list of daily temperatures in a given country over a year. You may want to know the overall average temperature, the average temperature by region, or the coldest day in the year. In this section, you will learn how to solve these calculations with PDI, specifically with the Group by
step.
The Group by
step allows you to create groups of rows and calculate new fields over these groups. To understand how to do the aggregations, let's explain it by example. We will continue using the sales Transformation from the first section of the chapter. Now the objective will be as follows—for each pair product line/product code, perform...