> 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/user-guide/8-optimization-in-planning/8.2-direction-based-optimization.md).

# 8.2 - Direction-based optimization

In this tutorial, you learn to use direction based optimization, define constraints, and apply optimized values to your planning sheet.

### Prerequisites

1. A planning sheet is created with measures, row, and column dimensions assigned.

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

   In this example, *PY Profit* is the difference between *PY Revenue*, *PY Purchase*, and *PY Transportation*. These measures are reported prior year actuals from the semantic model.

   <figure><img src="/files/SvoFCM9h4D5tZGmCAQrW" alt=""><figcaption></figcaption></figure>
2. Create data input measures (Independent variables). Native measures from the semantic model can't be edited. Before running optimization, create copies of the native measures that require optimization.

   In the **Planning** ribbon, go to **Insert Column > Number**. Select **Copy from another series**. Select the native measure to copy, in this case, *PY Revenue*.

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

   Enter the *Revenue Plan* as the measure name. Set **Insert as** to **Visual Measure**. Ensure **Input type** is **Number**, row and column aggregation types are **Sum**, and **Distribute parent value to children** is selected.

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

   Select **Create**. In this example, the same steps are repeated to create *Purchase Plan* from *PY Purchase*, and *Transportation Plan* from *PY Transportation*.
3. Create a formula measure (Dependent variable). The formula measure is the dependent variable. The independent variables are optimized to achieve the target value assigned to the dependent variable.

   In the **Planning** ribbon, go to **Insert Column > Formula**.

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

   Enter the *Profit Plan* as the measure name and enter the formula. Set **Insert as** to **Visual Measure**. Ensure the **input type** is **Number**. Row and column aggregation types must be set to **Formula**.

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

   Select **Create**.
4. Manage Column Display

   To view all the measures in the planning sheet, in the **Planning** ribbon, go to **Show Columns** and select the settings icon.

   <figure><img src="/files/43YaDNhsR9jjLVvrNMeP" alt=""><figcaption></figcaption></figure>

   To focus on the measures required for optimize, deselect the native measures from the semantic model. In this example, the visual measures are *Profit Plan*, *Revenue Plan*, *Purchase Plan*, and *Transportation Plan*. Only the selected measures are displayed in the planning sheet.

   <figure><img src="/files/JRLBB8yMdn1faTi4W66n" alt=""><figcaption></figcaption></figure>
5. Configure Aggregation Settings. Select the aggregation icon(Σ). Set **Row Grand Total** and **Row Subtotal** to **Top**.

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

### Configure optimizer (Direction-based)

In this previous section, Optimize is used to achieve a specific target value. In this section, the steps outline how to achieve the maximum value for *Profit Plan* within specified constraints.

1. Select the cell that shows the total Profit Plan.
2. Select **Optimize**.

   <figure><img src="/files/3APIKLvHF6wiwW4T4Jp0" alt=""><figcaption></figcaption></figure>
3. Set **Objective** to **Target**, then select the independent variables, that is, the data input measures (*Revenue Plan*, *Purchase Plan*, and *Transportation Plan*) in the **Variables to Update** section. Select **Next**.

   <figure><img src="/files/LgCpQ7hgHkyaQojPRoNy" alt=""><figcaption></figcaption></figure>
4. Select **Add Constraint** to define thresholds for the independent variables. Refer to Add constraints to know more about configuring thresholds.
5. Select **Run** to start the Optimizer.

   <figure><img src="/files/Vq4UMvzABkqckpli9h6S" alt=""><figcaption></figcaption></figure>
6. The **Target Value** of **55m** is achieved by simulating values of *Revenue Plan*, *Purchase Plan*, and *Transportation Plan* (the independent variables). Review the simulated values.

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

{% hint style="success" %}
If the target value isn't achieved, users can change the following parameters and rerun the Optimizer.

* **Strategy**: (from 1 to 10) defines the size of adjustments made while trying to achieve the target.
* **Tolerance %**: (from 0.1 to 20) is the acceptable deviation between the target value and the optimized value.
* **Number of iterations**: (from 1,000 to 10,000) refers to the total number of times the Optimizer updates its internal mathematical model to move closer to the target value by changing the values of the independent variables.
  {% endhint %}

1. Select **Apply** to replace the values of the data input measures with the optimized values.

   <figure><img src="/files/Eb8rlinITNBmQSASKFIp" 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/user-guide/8-optimization-in-planning/8.2-direction-based-optimization.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.
