# Row Denormaliser

The Row denormaliser step can be used to try to improve performance either by adding redundant copies of data values or by grouping data. You can also use this step to convert data types.

{% hint style="info" %}
You must normalize the data before you can denormalize it.
{% endhint %}

For example, consider the following set of normalized data:

| Produce Category | Delivery Time       | Produce Type |
| ---------------- | ------------------- | ------------ |
| fruit            | 2018/01/05 08:00:00 | apples       |
| fruit            | 2018/01/05 08:10:00 | oranges      |
| fruit            | 2018/01/05 08:20:00 | apples       |
| fruit            | 2018/01/05 08:30:00 | oranges      |

The data can be denormalized by grouping on the type of fruit:

| Produce Category | Apples              | Oranges             |
| ---------------- | ------------------- | ------------------- |
| fruit            | 2018/01/05 08:00:00 | 2018/01/05 08:10:00 |
| fruit            | 2018/01/05 08:20:00 | 2018/01/05 08:30:00 |

### General tab

Enter the following information in the transformation step fields:

| Field         | Description                                                                                                                                                                                                      |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Step name** | Specify the unique name of the transformation step on the canvas. The default is Row denormaliser.                                                                                                               |
| **Key field** | Define the key of the output row. The available fields come from the incoming PDI data stream. Another step with output data must be connected to the Row denormaliser step for options to appear in this field. |

### The fields that make up the grouping

![Group field table in Row denormaliser](/spaces/YwnJ6Fexn4LZwKRHghPK/files/3Si5SZcXhGjQU4JvJI69)

Use the **The fields that make up the grouping** table to specify which fields from the incoming PDI data stream define the grouping for the denormalization process.

You can click **Get Fields** to automatically fill the table with all fields from the incoming PDI data stream.

For more information, see [Understanding PDI data types and field metadata](/pdia-data-integration/understanding-pdi-data-types-and-field-metadata.md).

### Target fields

![Target fields table in Row denormaliser](/spaces/YwnJ6Fexn4LZwKRHghPK/files/jazE7W6YWLNUn6sCgZu0)

Use the **Target fields** table to select the fields to denormalize by specifying the string value for the **Key field**.

Options are provided to convert data types. Strings are most common as key-value pairs, so you often convert to Integer, Number, or Date.

If you get key-value pair collisions (the key is not unique for the specified group), specify the aggregation method to use.

You can click **Get lookup fields** to retrieve fields from the PDI data stream.

### Examples

The `data-integration/samples/transformations` directory contains the following example KTRs that show how to use this step:

| Example KTR file                                     | Description                                                        |
| ---------------------------------------------------- | ------------------------------------------------------------------ |
| `Denormaliser – Simple Example.ktr`                  | Converts a ‘month’ row in a record to multiple ‘month’ columns.    |
| `Denormaliser – Data Conversion and Aggregation.ktr` | Converts data values by ‘month’.                                   |
| `Denormaliser – 2 Series of Key-Value Pairs.ktr`     | Converts ‘name’ and ‘ID’ rows to multiple ‘name’ and ‘ID’ columns. |
| `Denormaliser – Capturing Last State Timestamp.ktr`  | Aggregates data values by ‘state’.                                 |

### Metadata injection support

All fields of this step support metadata injection. You can use this step with [ETL metadata injection](/pdia-data-integration/pdi-transformation-steps-reference-overview/etl-metadata-injection.md) to pass metadata to your transformation at runtime.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pentaho.com/pdia-data-integration/pdi-transformation-steps-reference-overview/row-denormaliser.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
