Pivoting tables
Working with Pivot tables comes naturally for Power BI developers with an Excel background. The pivot table is a compelling and common functionality across many data analysis tools, including Power Query in Power BI. The pivoting functionality accepts a table, rotates the values of the selected other column as column headers, groups the unique values of all other columns, and calculates the aggregation of values of the selected column by the other columns. In other words, the pivot function aggregates the intersection of the column that represents column headers and all other columns in the table. When we pivot a table in Power Query, we use the following function:
Table.Pivot(table as table, pivotValues as list, attributeColumn as text, valueColumn as text, optional aggregationFunction as nullable function)
In the preceding function:
table
is the function’s input.pivotValues
is a list of values of the column that rotates as column...