> 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/optimize-overview/maximize-or-minimize-a-target-value.md).

# Maximize or minimize a target value

Direction-based optimization adjusts one or more data input measures to maximize or minimize the selected objective measure while satisfying the defined constraints.

### Prerequisites

Before you begin, review the [Prerequisites section for Optimize](/planning-sheets/how-tos/optimize-overview.md#prerequisites) to understand the initial setup requirements.

### Maximize a calculated field

To demonstrate direction-based optimization, you will maximize the calculated field - *Profit forecast* by optimizing independent variables - *Revenue Forecast*, *Purchase Forecast*, *Advertising Forecast*, and *Transport Forecast*.

{% hint style="info" %}
You can optimize values at any hierarchy level. In this example, you will optimize at the total level. When Optimize runs on a parent cell, it recalculates the required change and distributes the updated value to the underlying editable child cells.
{% endhint %}

1. Select the target cell in the calculated measure. In the **Planning** ribbon, select **Optimize**. In this example, select the target cell from the *Profit Forecast* measure.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F9UMUtkikj12p0kj4dFMV%2Fimage.png?alt=media&amp;token=2909a991-d8ab-4fa1-acb7-2b3d2e3f5802" alt=""><figcaption></figcaption></figure>

2. To achieve direction-based optimization,

* Set **Objective** to **Maximize** to achieve the highest possible value. For example, maximize revenue, profit, or return on investment.
* Set **Objective** to **Minimize** to achieve the lowest possible value. For example, minimize cost, expenses, or inventory holding costs.\
  In this example, the **Objective** is set to **Maximize** to arrive at the maximum *Profit Forecast*.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FbWu7gGNHCO8fVpYaeaim%2Fimage.png?alt=media&amp;token=6ae6c449-9c17-4d9f-bdd8-1127d726aba7" alt=""><figcaption></figcaption></figure>

3. Select the data input or forecast measures (independent variables) to optimize from **Variables to Update**. In this case, Optimize adjusts the *Revenue Forecast*, *Purchase Forecast*, *Advertising Forecast*, and *Transport Forecast* to maximize the *Profit Forecast*. Select **Next**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FwxvyFknSFgzYGg1HrrdT%2Fimage.png?alt=media&amp;token=ad5dc2ad-94cc-4c58-acbc-363e143114cc" alt=""><figcaption></figcaption></figure>

4. Select **Add Constraint** to define the minimum and maximum limits for the data input measure. For more information, see [Configure optimization thresholds](/planning-sheets/how-tos/optimize-overview.md#configure-optimization-thresholds).

{% hint style="info" %}
Adding constraints is optional. Directly select **Run** to skip defining constraints; however, as a best practice, explicitly specify constraints for all the independent measures used in Optimize.
{% endhint %}

5. Choose the measure to apply the constraint from **Apply to Variable**. Select **Range** for the **Set Type** option. Enter the minimum and maximum optimization thresholds.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F1A0XvCbuVpdM6jiRQtv2%2Fimage.png?alt=media&amp;token=f5257e84-1ede-4e7b-95d9-0814355e65ab" alt=""><figcaption></figcaption></figure>

6. Select **Apply**. Select **Add** to specify additional constraints. Select **Run** after you define all the constraints.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FcHE7yBxUv4PSkU9QsDyz%2Fimage.png?alt=media&amp;token=ae3e4f69-1ff7-40ce-adea-6b31d54559f7" alt=""><figcaption></figcaption></figure>

7. Review the adjusted values and select **Apply** to update the values of the independent measures with the optimized values. For more information about Optimize parameters, see [Adjust parameters to achieve targets](/planning-sheets/how-tos/optimize-overview.md#adjust-parameters-to-achieve-targets).

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FrBB7IgjHUsovlbvpl8yk%2Fimage.png?alt=media&amp;token=80cedc1e-d74c-47b7-8fee-d90360e9d6df" alt=""><figcaption></figcaption></figure>

8. Optimize increases the *Profit Forecast* to 50.46m from 43.92m after adjusting independent measures within the specified constraints. Since you applied Optimize on a total value, the update is cascaded to all the related child dimensions.

{% hint style="info" %}
Optimize will not change the values of locked cells.
{% endhint %}

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FoASYIbtgDvcS1hCsyxMo%2Fimage.png?alt=media&amp;token=1c6f8873-70e3-4f55-9f99-3597d1c5a22e" 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/optimize-overview/maximize-or-minimize-a-target-value.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.
