> For the complete documentation index, see [llms.txt](https://docs.inforiver.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inforiver.com/working-with-inforiver/4.-adding-business-logic-and-formulae/template-rows/template-rows.md).

# Template rows (WB Matrix)

Let us take this example: Sales data by region and category. Let's insert a calculated row in each hierarchy which is 1.5 times the value of Beverages across quarters.

**STEP 1:** Click on the row above which to insert a template row. Create a calculated row by choosing the **Formula** option from the Insert Row menu.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FURmEhfdWLwg20jeHP8jm%2Fimage.png?alt=media&amp;token=38af434c-7ba6-4c16-8034-ee5238133cac" alt=""><figcaption></figcaption></figure>

**STEP 2:** Select the Templated option. Enter the title and the desired formula in the editor. When you click Create, the row gets created across all levels of the hierarchy.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FDhEihNojWjha035y2gQP%2Fimage.png?alt=media&amp;token=f11a3306-0bd2-44fa-a2f8-0f9e2832d15f" alt=""><figcaption><p>Creating a calculated template row</p></figcaption></figure>

**STEP 3:**  Set the row position to ‘First’, ‘Auto’, or ‘Last’ from the drop-down.

* First - the template row will be placed first at the category level, irrespective of where it is added
* Auto - the template row is placed above the selected row where it is added
* Last - the template row is placed last at the category level, irrespective of where it is added

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FDrcbp0ncBQ8CaiJeWBjg%2Fimage.png?alt=media&amp;token=426c92c2-c1e7-4d4d-a826-dc5f27e3f88c" alt=""><figcaption><p>Row position</p></figcaption></figure>

**STEP 4:** To include the row value in subtotals and totals, check the 'Include in total' check box.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FNQMTKFNnf7diAYO4VcqV%2Fimage.png?alt=media&amp;token=fab60d13-da26-4be3-9522-28855ee3bd00" alt=""><figcaption><p>include in total</p></figcaption></figure>

**STEP 5:** If charts are added to the table, the 'Include in charts' option allows you to visualize the calculated rows as well using charts.

{% hint style="info" %}
The 'Include in charts' checkbox is enabled only when the 'Include in total' option is unchecked.
{% endhint %}

**STEP 6:** You can add a description for the formula if needed.&#x20;

The below image shows another example, where the rows 'Medium-Large' are defined as the previous month's value for the size 'Medium'. To learn more about the formula used, refer to [RELATIVE\_COLUMN](/formula-syntax/identifiers/relative_column.md).

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2Fy08QNy5YzbdDi1coj7Wc%2Fimage.png?alt=media&amp;token=02d3ccfb-7807-4ca0-a8d9-c0192b7d3e04" alt=""><figcaption><p>Template row</p></figcaption></figure>

Edit/delete the inserted template row by clicking on the row gripper of the selected template row and choosing the respective option from the drop-down.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2F2byFepu0JJCduYSztSC6%2Fimage.png?alt=media&amp;token=9338ddd4-7b21-4120-8725-e29ad61dd3f3" alt=""><figcaption><p>Edit or delete template rows</p></figcaption></figure>

## Dynamic Referencing of Sibling's child in Templated Rows.

You can reference a sibling's child in Templated Rows. A Dynamic reference feature has been included, which enables you to reference the siblings' child row values while inserting calculated template rows. Through this dynamic referencing, the value gets auto-populated depending on the Parent class.

In the image below, we refer to the value of 'Juices' under the 'Beverages category', for the inserted Template rows. This value is reflected in the inserted template rows across all the sibling categories within the same sub-region. In this case, Beverages and Water, in the sub-region 'APAC'.

When we check the values of the inserted Templated rows within the sub-region 'EMEA' we see the values are dynamically referring to the 'Juices' under 'Beverages' within 'EMEA'.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FCOm1Wz95Nqxr2jSdEtTn%2Fimage.png?alt=media&amp;token=1a31d3e5-04a5-4e0b-8300-3923fcedcc59" alt=""><figcaption><p>Referring to a sibling's child in templated rows.</p></figcaption></figure>

When we check within the United States region, under the central sub-region, the siblings Beverages and Water contain a new templated row whose value dynamically refers to the value of Juice under Beverages within the same sub-region.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FUO2cf5sHHt37nTvoTCIw%2Fimage.png?alt=media&amp;token=9e88937e-5635-4b12-8c54-adb8f65b5e20" alt=""><figcaption><p>Dynamic referencing of values inside templated rows, depending upon the parent class.</p></figcaption></figure>

## Conditional template rows

You now have additional control over which levels to create template rows in. Click the configure link in the Template conditions section. You can directly select the row categories by selecting the **Simple** radio button.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FLry4fh54E9LmjurFw2ng%2Fimage.png?alt=media&amp;token=ed50a3af-a395-431f-ba52-c22648eef973" alt=""><figcaption><p>Selecting the row categories to create template rows</p></figcaption></figure>

The 'Amarilla Enhc' row has been created only for the 'Channel Partners' and 'Government' product segments.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FfNNS1QrphrQ1hK3KGeya%2Fimage.png?alt=media&amp;token=8a0ce033-e7b4-4241-a314-84e361988c4a" alt=""><figcaption><p>Conditional template rows created for specified row categories</p></figcaption></figure>

You can specify more complex filter conditions by selecting the **Advanced** option. In this example, we have added two group filters: one for Central + Home Office and the second for  East + Consumer.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FbGQo8xvpUrgcVd5U2465%2Fimage.png?alt=media&amp;token=7d1ec60d-45bd-4f5d-900d-914743a00768" alt=""><figcaption><p>Creating template rows based on filter conditions</p></figcaption></figure>

The 'Furniture enhc' row is created only for Central > Home Office and East > Consumer levels based on the filter conditions specified.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2FNM0yZPutVfhinFBKKiBR%2Fimage.png?alt=media&amp;token=6653dfc2-1588-415d-a62f-198cb3d441e3" alt=""><figcaption><p>Template rows created based on specified conditions</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.inforiver.com/working-with-inforiver/4.-adding-business-logic-and-formulae/template-rows/template-rows.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
