# Create templates for reusable row structures

In this article, you learn how to create templates and use them in your 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.

<figure><img src="/files/5OfJsUKpWbfkHEOe6wtG" alt=""><figcaption></figcaption></figure>

### Create a template

1. Consider the following model, which consists of repeated line items as rows for different companies.

<figure><img src="/files/oK7BljaCOdFncSBMlcNU" alt=""><figcaption></figcaption></figure>

2. To build a model structure that categorizes revenue and costs separately, you can create a template. A template is essentially a subset or a mini model that can be reused across your model for different categories wherever needed.

{% code overflow="wrap" %}

```
Gross Profit
	Gross Revenue
		Sales
		Other Revenue
	COGS
		Cost of Sales
		Support Costs
		Rent
		Other Costs
```

{% endcode %}

3. Select the row where you want to insert the template, then select **Insert Template**.

<figure><img src="/files/Kow0O2fnKXEgbi5tloES" alt=""><figcaption></figcaption></figure>

4. Build the template as you would build a model. First, rename the template by double-clicking and updating the name.
5. To add child rows, click the **+** icon (**Add Child**) or select **Insert Row**. Alternatively, you can use **Bulk Insert** to create the template structure at once.

<figure><img src="/files/iP9yrHA0GEc68zkpiBCd" alt=""><figcaption></figcaption></figure>

The template structure is created as shown:

<figure><img src="/files/j8xK1d7vKeNzJZBfOXxb" alt=""><figcaption></figcaption></figure>

6. Configure the template's rows.

<figure><img src="/files/LGdULk4i2XW0tTSKFu24" alt=""><figcaption></figcaption></figure>

### Ways to insert template

Templates can be inserted into the model in two ways:&#x20;

* **Append**: Append inserts the template row structure within the model as it is.&#x20;

<figure><img src="/files/wmIggSUnqDsVOS7Iejdh" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/iuI1RaPoHgTveNlOIxN7" alt=""><figcaption></figcaption></figure>

#### Set Conditions

Insert the template at only specific levels in the model based on filter or set criteria. Assuming you have added two row dimensions, *Company* and *Department,* you can now set conditions based on them.

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

<figure><img src="/files/0uyuEzcfKGzSY13whGZr" alt=""><figcaption></figcaption></figure>

**Advanced:** Define complex rules for applying templates by combining multiple filters and groups.

<figure><img src="/files/l9W0p5YTS1B6lY2MMhhB" alt="" width="375"><figcaption></figcaption></figure>

In this mode, you can:

* Add multiple **filters** (for example, *Department is Admin* or *Company contains B*)
* Group filters using logical operators such as **AND** and **OR**
* Create nested **groups** to build multi-level conditions

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
* Apply a template when *Department is Admin OR Company contains B*
* Additionally apply it for a specific group where *Department is Marketing AND Company is not C*

### Apply template to the model

If you choose **Replace**, the template is applied to the model as shown below. The template cannot be edited directly from the model; instead, edit the template to modify the row structure.

<figure><img src="/files/g2TieKFH95o6JWZ7uTCL" alt=""><figcaption></figcaption></figure>

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

### Manage templates

Select **Manage Template** to edit, duplicate, or delete inserted templates.&#x20;

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 **Add** icon to create a new blank template.
* Select **Duplicate** icon to create a copy of the selected template.
* Select **Delete** icon to delete the template.

<figure><img src="/files/YH0UgoX4HKqrlB5l8Ors" alt=""><figcaption></figcaption></figure>


---

# 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.fabricplan.com/planning-sheets/how-tos/create-templates-for-reusable-row-structures.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.
