> 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-tutorials/6-build-a-p-and-l-hierarchy-with-row-model.md).

# 5 - Build a P\&L hierarchy with Row Model

In this tutorial, you build and configure a row-based P\&L model using the Row Model Builder by defining Net Profit as the root, organizing Gross Revenue, Net Revenue, COGS, and Operating Expenses into a connected hierarchy, and configuring formula and aggregate relationships to see how driver-level inputs roll up to Net Profit in real time.

### Prerequisites

Before you start this tutorial, ensure you complete the first tutorial: [Introduction to Fabric Planning](/planning-tutorials/1-introduction-to-fabric-planning.md).

### Configure a row model

In this section, you build a P\&L hierarchy from scratch using Row Model Builder, starting from Net Profit and adding Gross Profit, Net Revenue, COGS, and Operating Expenses as connected nodes. Formula and data source rows define how each level calculates from the ones beneath it.

1. In *Northwind\_FMCG\_Plan*, select **New Planning Sheet** in the **Home** ribbon. Enter P\&L – Row model and select **Create**.
2. Configure the field assignments from the P\&L Rows as follows:

| Field   | Value                               |
| ------- | ----------------------------------- |
| Rows    | Account                             |
| Columns | Date hierarchy—Year, Quarter, Month |
| Values  | Value                               |

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FDTWgFXggZ73xx8FAYtCb%2Fimage.png?alt=media&amp;token=d1f511f7-ff69-4db9-8353-fd3cf79dcaf4" alt=""><figcaption></figcaption></figure>

3. Go to the **Model** ribbon and select **Row Model**. The **Model Builder** dialog appears. Select **Enable**.
4. In the **Row Model** window, select the box corresponding to **Row Name**. Retain only the root node that is the *All* row, and delete the rest of the rows. Deselect the **All** row. Select **Delete**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FNJgbqNU5snrFzToby58u%2Fimage.png?alt=media&amp;token=0cffcf10-b530-4c19-af8e-d5e1bf2ebb55" alt=""><figcaption></figcaption></figure>

A warning message appears asking for confirmation. Select **Delete**. The canvas is now ready to build a new row model.

5\. Select the *All* row and select the edit icon. In the side pane, set the **Row Name** to *Net Profit*. In the **Configure as** dropdown, select **Formula**. Select **Apply**.

{% hint style="info" %}
You will enter the formula after creating other nodes in the row model.
{% endhint %}

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FIr6gxxVv0xnbel0eC9IR%2Fimage.png?alt=media&amp;token=dcc78a1a-0169-4f8b-8b73-f514fd1916da" alt=""><figcaption></figcaption></figure>

This action replaces the root node (*All* row) with *Net Profit*.

6. Select the *Net Profit* row. Select **Add Child** > **Formula**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FmNjmptgZzYv1jVWGQH6H%2Fimage.png?alt=media&amp;token=defa1520-ae22-4fd7-bc35-090dcd4844e1" alt=""><figcaption></figcaption></figure>

7. Select the edit icon, name it *Gross Profit*, and select **Apply** to add *Gross Profit* as a child under *Net Profit*.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FLhLjPYKugeiuexduR2DE%2F5-gross-profit-added-child-row.png?alt=media&amp;token=49577abe-2d50-4442-bcc0-79237121aeb9" alt=""><figcaption></figcaption></figure>

8. Select *Gross Profit*. Select **Add Child** > **Formula**. A new child row is added under *Gross Profit*. Select the edit icon, name it *Net Revenue*, and select **Apply**.
9. Select *Net Revenue*. Select **Add Child** > **Data Source**. Select the edit icon, name it *Gross Revenue*.
10. In **Choose Close Period Source Row**, select the corresponding source row from the semantic model. In this case, search for and select *Gross Revenue*. Select **Apply**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F0Is19l2Iy3G8pjJEreCN%2F6-side-pane-gross-revenue-data-source.png?alt=media&amp;token=dabf14df-730f-469f-a6e2-e8dfc8b8a984" alt="" width="375"><figcaption></figcaption></figure>

This action adds *Gross Revenue* as a child node under *Net Revenue.*

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fvtqzq0mOlrsBvcRBYlYo%2F7-net-revenue-data-source-gross-revenue.png?alt=media&amp;token=78f5ed48-c49b-4daf-8b16-e323d65b7c74" alt=""><figcaption></figcaption></figure>

11. Select *Gross Revenue*. Select **Add Sibling** > **Data Source**. Select the edit icon, and name the row *Returns and Breakage.*
12. Select **Choose Close Period Source Row,** search for and select *Returns and Breakage* from the semantic model. Select **Apply**.
13. In the same way, add *Distribution Allowance & Rebates* and *Federal & State Excise Taxes* as siblings to *Gross Revenue* under *Net Revenue*.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FlJRq6n6xPUU16nWCOHWw%2F8-insert-sibling-rows-net-revenue.png?alt=media&amp;token=d71da57d-b709-478d-9c98-84dba18a884b" alt=""><figcaption></figcaption></figure>

14. Select the **Configure Formula** box on the *Net Revenue* row. Enter the following formula: `[Gross Revenue] -[Returns and Breakage] - [Distribution Allowance & Rebates] - [Federal & State Excise Taxes]` . Select **Apply**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FuSdjweeVB8Kd0gh00cTp%2F9-enter-net-revenue-formula.png?alt=media&amp;token=bf180628-9469-475b-b106-07fc71a765fa" alt=""><figcaption></figcaption></figure>

15. Select *Net Revenue*. Select **Add Sibling** > **Aggregate**. Select the edit icon, name the row *COGS*, and select **Apply**.
16. In the same way you created Gross Revenue in step 10, to create children under the COGS row, select **Add Child** > **Data Source** and create rows for the following categories:

* Brewing Materials
* Packaging, Plant Overhead and Maintenance
* Water & Utilities

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FHiREemunzKEe85ckIDCy%2F11-create-cogs-hierarchy.png?alt=media&amp;token=23fe1c09-6646-4c8a-95e8-99c8109439ef" alt=""><figcaption></figcaption></figure>

17. Enter the formula for *Gross Profit* 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%2FdIENnWalxBih1ROf5Frx%2F12-gross-profit-formula.png?alt=media&amp;token=f162f14f-b9a2-4ba9-ac40-28a2a93432f6" alt=""><figcaption></figcaption></figure>

18. Create a hierarchy for *Operating Expenses* using the **Add Child** > **Data Source option.**

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fbc3zRmjSLIEQRKJGngQY%2Fcreate-operating-expenses-hierarchy.png?alt=media&amp;token=d7ed08d8-a522-430c-8a32-983a066f9372" alt=""><figcaption></figcaption></figure>

19. Finally, enter the formula for *Net Profit:* `[Gross Profit]-[Operating Expenses]`

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F5JbLJQ22RAcNi8TAGBal%2F14-enter-net-profit-formula.png?alt=media&amp;token=2c65c03a-141c-4fcc-aca1-b7598d79b08d" alt=""><figcaption></figcaption></figure>

20. Select **Back to Home**. Observe that the planning sheet now displays the full P\&L hierarchy — *Net Profit* at the root, with *Gross Profit*, *Net Revenue*, *COGS*, and *Operating Expenses* as connected nodes. Expanding any node shows its contributing data source rows.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FIOQzxB69XzI5Sp383keN%2F15-view-profit-loss-hierarchy-planning-sheet.png?alt=media&amp;token=42e84bb5-ac95-436d-95a3-26f9b967aa04" 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-tutorials/6-build-a-p-and-l-hierarchy-with-row-model.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.
