##### Page tree

Contents:

NOTE:  Designer Cloud Educational is a free product with limitations on its features. Some features in the documentation do not apply to this product edition. See Product Limitations.

Contents:

pivot table summaries data that is sourced from another table. Using pivot tables, you can calculate aggregating functions, such as sums, maximums, and averages for one or more columns of data.

Optionally, these sums can be performed across groups of values from one column and broken out in columns based on the values in another. In Designer Cloud Educational, a pivot table is composed of the following basic elements:

Pivot table elementDescription
Column labelsList of one or more columns whose values are represented as the columns in the generated pivot table.
Row labelsList of one or more columns whose values become the rows in the generated pivot table.
Values

Also known as facts, these values are one or more aggregation formulas, which are calculated in the following manner:

"Show me the value of this formula computed by each row value for every value represented in the generated table."

NOTE: If your aggregation does not include the kind of transformation listed above, in which the data is pivoted from rows into columns, you can use the Group By transformation and an aggregate function. See Create Aggregations.

## Building a Pivot Table

Pivot tables are very powerful tools for summarizing and visualizing large-scale volumes of data. In  Designer Cloud Educational, search for `pivot table` in the Search panel to create one.

NOTE: A pivot table completely replaces the source table. Data that is not captured in the pivot definition is lost.

Tip: In your flows, you may find it useful to create your pivot tables in independent recipes that are chained from your primary recipe.

Example Data

Pivot tables are perhaps best explained by example. The following table snippet captures transactional data from a number of stores for a range of products across a set of dates. Transactional values include total sales, quantity, and cost (`POS_Sales``POS_Qty`, and `POS_Cost`):

DailyStore_NbrPOS_SalesPOS_QtyPOS_CostPRODUCT_DESC
2/8/1317074.97ACME LAWN GARDEN BAG CLEAR
2/7/132000ACME SANDWICH BAG
2/7/1327.0865.58ACME SODAS SALTED
2/7/1323.9222.82ACME SCENTED OIL REFILL-CTRY SUN
2/7/132000ACME SUGAR ICE WAFERS VANILLA
2/7/1333.1622.86ACME ZOO ANIMAL FRUIT SNACKS 6'S
2/7/1333.1622.78ACME WAFERS SUGER ICE
2/7/1333.1622.82ACME SCENTED OIL REFILL-CTRY SUN
2/7/1336.3245.92ACME RICE CRACKERS ONION
2/2/1397076.51ACME KITCHEN BAG
2/2/1391701715.81ACME SNACK BAGS RESEALABLE
2/2/1392042.16ACME CHEDDARY SN CRACKERS/PROCES
2/2/1396.528.98ACME RICE CRACKERS TERIYAKI
2/2/1393063.24ACME RICE CHIPS CHEDDAR
2/1/1371010.82ACME DIGESTIVE RICH TEA BISCUITS
2/1/1371201211.16ACME KITCHEN BAG
2/1/1379098.37ACME SNACK BAGS RESEALABLE
2/1/1379.51910.26ACME CHEDDARY SN CRACKERS/PROCES

## Available Aggregations

The Pivot data transformation supports use of any aggregation function. For more information, see Aggregate Functions.

## Simple Pivot Table

From the above, suppose you are interested in the sales from each store for each product. You can use the following transformation to compute these aggregated calculations:

Transformation Name `Pivot table` `Store_Nbr` `PRODUCT_DESC` `SUM(POS_Sales)` `500`

In the above transformation:

• The Column labels entry specifies the column whose values make up the calculated columns of the pivot table. The calculation is performed across each of these values. In this case, each column contains calculations for separate store numbers.
• The Row labels entry specifies the column whose values define the grouping of the calculations. In this case, the sum of the sales column is performed for each product description value for each store.
• The Values entry specifies the aggregation function to compute for each cell in the new table. In this case, you are generating the sum of sales for each product description in each store.
• By default, this transformation generates a maximum of 50 new columns. However, if the column used for your Column labels contains more than 50 values, you may want to raise this value.

NOTE: Avoid creating datasets wider than 2500 columns. Very wide datasets can cause performance degradation.

Results:

PRODUCT_DESCsum_POS_Sales_1sum_POS_Sales_2sum_POS_Sales_3sum_POS_Sales_7sum_POS_Sales_9
ACME LAWN GARDEN BAG CLEAR700000
ACME SANDWICH BAG00000
ACME SODAS SALTED07.08000
ACME SCENTED OIL REFILL-CTRY SUN03.923.1600
ACME SUGAR ICE WAFERS VANILLA00000
ACME ZOO ANIMAL FRUIT SNACKS 6'S003.1600
ACME WAFERS SUGER ICE003.1600
ACME RICE CRACKERS ONION006.3200
ACME KITCHEN BAG00012070
ACME SNACK BAGS RESEALABLE00090170
ACME CHEDDARY SN CRACKERS/PROCES0009.520
ACME RICE CRACKERS TERIYAKI00006.5
ACME RICE CHIPS CHEDDAR000030
ACME DIGESTIVE RICH TEA BISCUITS000100

## Conditional Aggregations

Suppose you are interested in only in the sum of sales for store numbers 1-3. To capture a more limited dataset, you can use the `SUMIF` aggregation function:

Transformation Name `Pivot table` `PRODUCT_DESC` `SUMIF(POS_Sales, Store_Nbr<4)` `500`

Most aggregation functions have a conditional (`*IF`) variant.

## Multiple Aggregation Levels

None of the axes of a pivot table is limited to a single dimension. You can have multiple Column labels, Row labels, and Values (formulas). In the following transformation, aggregations have been further broken out by date, and an additional formula (Value) has been added.

NOTE: Adding multiple Column labels and Values can greatly expand the width of the dataset. Generally, adding Row labels does not expand the total count of rows.

Transformation Name `Pivot table` `Store_Nbr` `Date` `PRODUCT_DESC` `SUM(POS_Qty)` `SUM(POS_Sales)` `500`

Results:

NOTE: Following results table is incomplete. Some columns have been omitted for space reasons.

DailyPRODUCT_DESCsum_POS_Qty_1sum_POS_Sales_1sum_POS_Qty_2sum_POS_Sales_2sum_POS_Qty_3sum_POS_Sales_3
2/8/13ACME LAWN GARDEN BAG CLEAR7700000
2/7/13ACME SANDWICH BAG000000
2/7/13ACME SODAS SALTED0067.0800
2/7/13ACME SCENTED OIL REFILL-CTRY SUN0023.9223.16
2/7/13ACME SUGAR ICE WAFERS VANILLA000000
2/7/13ACME ZOO ANIMAL FRUIT SNACKS 6'S000023.16
2/7/13ACME WAFERS SUGER ICE000023.16
2/7/13ACME RICE CRACKERS ONION000046.32
2/2/13ACME KITCHEN BAG000000
2/2/13ACME SNACK BAGS RESEALABLE000000
2/2/13ACME CHEDDARY SN CRACKERS/PROCES000000
2/2/13ACME RICE CRACKERS TERIYAKI000000
2/2/13ACME RICE CHIPS CHEDDAR000000
2/1/13ACME DIGESTIVE RICH TEA BISCUITS000000
2/1/13ACME KITCHEN BAG000000
2/1/13ACME SNACK BAGS RESEALABLE000000
2/1/13ACME CHEDDARY SN CRACKERS/PROCES000000

## Group By

If you wish to maintain the original dataset values, you can apply an aggregate function within a single column.