User GuidesAPI ReferenceRelease Notes
Doc HomeHelp CenterLog In
User Guides

Use Unpivot to change the shape of a table. Unpivot reorganizes the structure of the table by taking related columns of data and moving them into different rows.

Unpivot creates new records. Tamr creates primary keys for them. See Primary Key Management.

Example Use

In the following example, the source datasets have an attribute for spend each quarter. You can use Unpivot to reorganize this table and change these four attributes into two: one for which quarter the spend was in, and one for the spend itself.

1708

Before unpivot, the customer was represented by one record in the dataset, and each quarter of spend was one column.

We will be populating the attribute labeled Quarter with the header from each of the attributes Q1, Q2, Q3, and Q4. The Spend attribute will be filled with values from the corresponding quarter.

786 750

The result is that Quarter and Spend are filled with the information from the original dataset. The columns that the data was extracted from are emptied. Any other unified attributes are preserved for each record. This particular example will result in four times as many records, since four attributes were unpivoted.

1702

The customer is now represented by four records.

Unpivoting Additional Attributes

When multiple attributes need to be unpivoted together, you can add dependent columns. One common use case is when the variable attribute contains data that have different units. In this case, you can add the units column as a dependent column.

520

Choose "add dependent column" and select Unified Attributes from a dropdown menu. Drag and drop the dependent column (from the list at the left) to its corresponding attribute (on the right). In our example, the attribute containing unit information (VSTEMP_U) is the dependent column.

1177

Here is a sample of how it works. To see it, choose the information icon:

581