> For the complete documentation index, see [llms.txt](https://docs.fabricplan.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fabricplan.com/planning-sheets/how-tos/measure-and-row-based-planning/row-based-modeling/create-templates-for-reusable-row-structures.md).

# Create row model templates

This article explains how to create templates and use them for your row model.

A *template* is a predefined layout of rows that can be used to build models with repetitive structures. You create the template once based on your requirements and reuse it multiple times across the model.

For example, a template such as *Net Profit* can be created once and then applied across different product categories to maintain a consistent structure. A sample scenario is illustrated in the following image:

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F7lHidKHW6GOvlabuLaKN%2Fimage.png?alt=media&amp;token=d63d9202-c699-4d72-b9ac-9abbe33d4196" alt=""><figcaption></figcaption></figure>

### Benefits of creating a template

Creating a template lets you define a reusable row structure once and apply it wherever the same structure is needed in a model. This is useful when your model contains repeated structures across categories, companies, departments, or other dimensions.

Use templates to:

* **Reuse row structures:** Create a predefined set of rows once and apply it to multiple parts of the model instead of rebuilding the same structure repeatedly.
* **Manage repeated structures centrally:** Edit, duplicate, or delete only the templates as your model requirements change, without manually finding and altering the structure throughout the model.
* **Maintain consistency:** Use the same hierarchy and line-item structure across different categories or entities.
* **Build models efficiently:** Create a template as a reusable subset or mini model and insert it across your model wherever required.
* **Append or Replace:** Insert a template by either appending it to the existing model or replacing the existing model structure with the template structure.

### Sample scenario <a href="#sample-scenario" id="sample-scenario"></a>

This article uses the following planning sheet as an example. The planning sheet is configured with **Region** and **Chart of Accounts** as row dimensions, **Year**, **Quarter**, and **Month** in the **Columns** field, and **Actuals** in the **Values** field.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fxo6yLZYwwCSx05RxqDQD%2Fimage.png?alt=media&amp;token=88cee666-1e17-4afc-8c22-1ad4cab32015" alt=""><figcaption></figcaption></figure>

This article walks you through creating a row model where you create a template to define the row model structure and insert the template for different regions.

### Enable model builder

The first step is to start building the row model using the Model Builder.

1. Select **Row Model** under the **Model** tab. The **Model Builder** pop-up opens. Select **Enable**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F4vNPBzF7e4s7swxBlFaM%2Fimage.png?alt=media&amp;token=1987e187-5795-4bd8-85c7-2f0921beb7d2" alt=""><figcaption></figcaption></figure>

2. This action enables **Model Builder**. You can select **Back to Home** to save the report and return to this screen by selecting **Row Model** again.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fz97DITowPflPvXxzD7Hr%2Fimage.png?alt=media&amp;token=993fe378-ade1-4aba-ad91-f691debd1192" alt=""><figcaption></figcaption></figure>

The model builder displays each row as a configurable driver for both open and closed periods, enabling you to build row-based models.

### Create a template

This model contains repeated line items for different regions. Create a template that defines the required row structure and reuse it for each region. In this example, the template groups revenue and expenses and calculates **Net Profit**.

{% code overflow="wrap" %}

```
Net Profit
    Revenue
    Expenses
        Advertising & Promotions
        Purchase
        Rent & Utilities
        Salaries
        Transportation
```

{% endcode %}

1. Select the row where you want to insert the template, and then select **Insert Template**. This action creates a new template that you can configure.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F3HUiimH9V6z6CdslgL5F%2Fimage.png?alt=media&amp;token=1845215f-92fa-4470-bf21-7b537ac3024e" alt=""><figcaption></figcaption></figure>

2. Begin building the template as you would [create a row model](/planning-sheets/how-tos/measure-and-row-based-planning/row-based-modeling/create-a-row-model.md). Rename the template name and the top row by double-clicking *Template(1)* and updating the name.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fo1MgjP2fD4jTR2p2EKMe%2Fimage.png?alt=media&amp;token=8366cbf4-b6d2-43a6-b9cc-185f949ff824" alt=""><figcaption></figcaption></figure>

3. Select the *Net Profit* row and then select **Bulk Insert**. In the side panel, enter the row structure you want to add. Use **Tab** to add a row as a child at the next hierarchy level.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fk4AB6Ty1HuFZFWfWcQt2%2Fimage.png?alt=media&amp;token=cf10ae84-cb83-4489-b564-8fcd35d0e33a" alt=""><figcaption></figcaption></figure>

4. Select **Add**. The template structure is created as shown in the following image.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FBW1pZ5sEbduRuffpGT7G%2Fimage.png?alt=media&amp;token=97a01a32-2ce6-4d95-b02f-70c9ec202c5d" alt=""><figcaption></figcaption></figure>

### Configure the template rows

Configure the template's rows like you [configure a row model](/planning-sheets/how-tos/measure-and-row-based-planning/row-based-modeling/create-a-row-model.md#configure-the-row-model).

1. Configure all leaf rows to **Data Source** type and link them to their corresponding source rows.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FxS3YdPOalnSnzrJQUwof%2Fimage.png?alt=media&amp;token=f1b0d8b9-6460-4aaa-ac24-d509d0f6cf9e" alt=""><figcaption></figcaption></figure>

2. Set the **Desired Trend**. For *Revenue*, use *Increase* and for all child rows under *Expenses*, use *Decrease*.
3. For *Expenses*, use **Aggregate** and **Sum** to add all its child rows.
4. For *Net Profit,* use **Aggregate** and then choose **Subtract** since, `Net Profit = Revenue - Expenses`.

The template is complete.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FVy4XKvExqELhjCgwyTRR%2Fimage.png?alt=media&amp;token=24ea5dad-8c50-4674-9a27-8781ba218660" alt=""><figcaption></figcaption></figure>

### Ways to insert template

You can insert a template into the model using either of the following options:

* **Append:** Inserts the template row structure into the model as it is, without modifying the existing model structure.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FposvlyL2JdlBnfXuWHvF%2Fimage.png?alt=media&amp;token=f40bec79-e616-4cd2-9b00-cbc982de68f5" alt=""><figcaption></figcaption></figure>

* **Replace**: Replaces the existing model structure with the template's row structure.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FK96TxU2Q3EV3ufMcxa7U%2Fimage.png?alt=media&amp;token=e7980cfe-3b76-4e52-8022-7e34ad466752" alt=""><figcaption></figcaption></figure>

Use **Replace** for this example to replace the existing structure with the template structure for every region.

### Apply template to the model

If you choose **Replace**, the template is applied to the model as shown in the following image.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FY8X4fNphSFn1WbneFiOn%2Fimage.png?alt=media&amp;token=7b37e583-e14c-4753-90b9-2a0a1146b7c4" alt=""><figcaption></figcaption></figure>

You can't edit the template directly from the model. Instead, select [**Manage Template**](#manage-templates) to edit the template and modify the row structure.

You can create multiple templates for a model and apply them wherever required.

The row model in the planning sheet looks as below with a consistent structure for all regions.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fz9RsEGnFcnCe1NK4tqCx%2Fimage.png?alt=media&amp;token=def9b02c-b617-461b-ae99-04b19e9dbb5f" alt=""><figcaption></figcaption></figure>

### Set Conditions

You can use **Set Conditions** to insert the template at only specific levels in the model based on filters or set criteria.

1. Go to the **Row Model** window and open the templates section by selecting **Manage Template**.
2. Select **Set Conditions**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FpRd7u3WaW1wD5kLCtElz%2Fimage.png?alt=media&amp;token=30121ac9-457d-472b-823b-d8cde3e71916" alt=""><figcaption></figcaption></figure>

3. There are two options to set conditions: **Simple** and **Advanced**.

* **Simple**: Choose the specific categories or levels where the template must be inserted. Use **Search** to find any level. This option is ideal for straightforward selection scenarios where no complex logic or grouping is required.

The following image shows *Asia* cleared. On selecting **Apply**, the template gets applied to all regions except *Asia*.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FMh4LfH8N35WKMXId6trH%2Fimage.png?alt=media&amp;token=8f0429d7-0d34-439c-96b1-a5e06f5f5b71" alt=""><figcaption></figcaption></figure>

The following image shows another example with two row dimensions in the planning sheet. You can select or clear the levels or categories where you want to apply the template.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FbPJq2SW0zM23KWLUkIt3%2Fimage.png?alt=media&amp;token=2e09bfc8-ee86-495a-9ccd-78c0a201bd4e" alt=""><figcaption></figcaption></figure>

* **Advanced:** Select **Advanced** to define complex rules for applying templates by combining multiple filters and groups.

In this mode, you can:

* Add multiple filters using **Add filter**.
* Group filters using logical operators such as **AND** and **OR**
* Create nested groups to build multi-level conditions using **Add group**.

Each group can have its own AND/OR logic, allowing you to control how conditions are evaluated. For example:

* The top-level group may use **OR** to apply the template if *any* condition is met.
* A nested group can use **AND** to ensure *all* conditions within that group are satisfied.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FWXEN5cvwD2fD6QJ7SnSg%2Fimage.png?alt=media&amp;token=df49387f-d745-4baf-9e25-1ac23e364b5b" alt="" width="375"><figcaption></figcaption></figure>

This example means:

* Apply a template when *Region is Asia OR Channel\_Name contains In.*
* Additionally, apply it for a specific group where *Region is Europe AND Channel\_Name does not begin with E*.

4. Select **Apply** to apply the filters. The template is applied only to the levels that meet the specified filter conditions.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FplWPUsOj28gCwCyVDBxb%2Fimage.png?alt=media&amp;token=d47ea411-a169-4500-a1c6-cb8ff57412d6" alt=""><figcaption></figcaption></figure>

### Manage templates <a href="#manage-templates" id="manage-templates"></a>

Select **Manage Template** to edit, duplicate, or delete templates.

Select the template that you want to modify from the list of available templates in the dropdown. Then choose the appropriate action icon to perform the required operation.

* Select the **Add** icon to create a new blank template.
* Select the **Duplicate** icon to create a copy of the selected template.
* Select the **Delete** icon to delete the template.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F53ukD1WXKmPz4eDfkF2F%2Fimage.png?alt=media&amp;token=93c1545c-50c4-4cea-8f47-3d0ef10af542" alt=""><figcaption></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 dynamically by asking a question.

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

```
GET https://docs.fabricplan.com/planning-sheets/how-tos/measure-and-row-based-planning/row-based-modeling/create-templates-for-reusable-row-structures.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
