> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/chart/measure-won-revenue-against-a-target.md).

# Measure Won Revenue Against a Target

Build a Gauge chart that compares won Opportunity revenue with a fixed monetary target, then verify its value, range and progress percentage.

A sales manager has a revenue goal of `200000` and wants to see how much has been won. Build an Avonni Gauge with the won Amount as its value and the goal as its maximum range. Both quantities use the same monetary unit.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FrdIONFM9yFyqSmC0SxmW%2Ftutorial-gauge-result.jpg?alt=media" alt="Gauge preview showing won revenue against a 200,000 target"><figcaption><p>Builder preview of 155,000 in won revenue against a 200,000 target.</p></figcaption></figure>

[View this capture at full size](https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FrdIONFM9yFyqSmC0SxmW%2Ftutorial-gauge-result.jpg?alt=media)

## Before You Start

* Open a Dynamic Component you can edit.
* You need access to Opportunity Amount and won status. Use one currency for both the source amounts and target.
* Prepare the sample from [Track Won Revenue by Month](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/chart/track-won-revenue-by-month.md), or write down a separately verified won total for your own records.
* See the [Chart reference](https://docs.avonnicomponents.com/dynamic-components/components/chart.md) and [Query guide](https://docs.avonnicomponents.com/dynamic-components/component-builder/data-sources/query.md) for the available properties and filters.

## Steps

{% stepper %}
{% step %}

### Establish the Won Total and the Goal

The monthly-revenue sample uses Opportunity names starting with `Chart Docs Trend -` . Its five won opportunities have Amount values `10000`, `20000`, `25000`, `40000` and `60000`, totaling `155000`. One open opportunity of `99000` and one lost opportunity of `88000` are excluded.

Use a goal of `200000`. With a zero minimum, the expected progress is `155000 / 200000 × 100 = 77.5%`.

Keep the goal separate from the records. It is a business target, not the largest Opportunity Amount, the record count or a value the chart should infer.
{% endstep %}

{% step %}

### Query the Won Opportunities

Add **Chart** from the **Component Library**. In **Edit Chart > Properties > Content**, set **Type** to **Gauge** and **Title** to `Won revenue against target`.

Set **Data Source** to **Query**. In **Records**, choose or create an Opportunity query. Use **Edit the query** to combine `IsWon = true` with Name (`Name`) starting with `Chart Docs Trend -` .

Keep all five won records, including both years in this sample. For a real period target, use your own scope and Close Date conditions, then independently calculate the won total for that same period.
{% endstep %}

{% step %}

### Map One Revenue Value

Open **Data Mappings > Value** and add one entry:

| Setting      | Value             |
| ------------ | ----------------- |
| Field        | Amount (`Amount`) |
| Measures     | Sum               |
| Format Style | Currency Rounded  |
| Multiplier   | `1`               |

A Gauge uses one aggregated value. It does not need a category, Lead Source grouping or a date grouping for this result.

The currency preset controls display formatting. It does not convert currencies. Keep the target in the same units as the unscaled Amount sum.
{% endstep %}

{% step %}

### Set the Monetary Range Explicitly

Open **Range Values**. Set **Min range** to `0` and **Max Range** to `200000`.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FBwot00PkKmDICkC69LNU%2Ftutorial-gauge-range.jpg?alt=media" alt="Gauge Range Values with a zero minimum and 200,000 maximum" width="320"><figcaption><p>Range Values sets the monetary goal independently from the queried Amount sum.</p></figcaption></figure>

[View this capture at full size](https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FBwot00PkKmDICkC69LNU%2Ftutorial-gauge-range.jpg?alt=media)

Turn on **Show Band Value** and **Show Band Percentage**. Leave **Show Band Range**, **Show Min Range** and **Show Max Range** off for this example. The scale ticks already show the zero minimum and the `200000` goal; the separate endpoint labels are optional.

The default **Max Range** is `100`. That is a numeric endpoint, not an instruction to convert an Amount sum into a percentage. Leaving it at `100` would compare revenue with a goal of one hundred monetary units.
{% endstep %}

{% step %}

### Verify Value and Progress Together

Click **Preview**. The sample shows `$155k` and `77.5%`, with scale ticks running from `$0` to `$200k`. Check these against the unscaled value `155000` and goal `200000`. The percentage display is separate from the currency value format.

The remaining amount to the target is `45000`. This is a useful independent check, even though this tutorial does not add a separate remaining-revenue display.

Confirm that the open and lost controls have not changed the value. If you change the goal, keep the query and Amount sum unchanged and recalculate the expected percentage. This example tests a zero minimum and a total below the target.
{% endstep %}

{% step %}

### Save and Test with Your Audience's Scope

Click **Save** when the value, endpoints and percentage agree. The figures show the Builder preview, not an activated Lightning Page.

Follow [Publishing your Dynamic Components](https://docs.avonnicomponents.com/dynamic-components/core-concepts/publishing-your-dynamic-components.md) when you are ready to place your component on a Lightning Page. Check its query as a viewer too: their accessible opportunities can produce a different won total against the same goal.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>The percentage is unexpectedly large</summary>

Check **Range Values > Max Range**. Replace the default `100` with your monetary goal and keep **Min range** at `0` for this exercise. Check **Multiplier** is `1`; a scaled Amount and an unscaled target use different units.

</details>

<details>

<summary>The gauge shows an average or record count</summary>

Open **Data Mappings > Value**. Use Amount and **Sum**. The target belongs in **Max Range**, not in the measure definition.

</details>

<details>

<summary>The value includes lost revenue</summary>

Check `IsWon = true`, not only a closed-status condition. Reconcile every included record with the exact name or reporting-period filters used by your independent total.

</details>

## Related Tutorials

* [Track Won Revenue by Month](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/chart/track-won-revenue-by-month.md): prepare the sample and check its monthly contributions.
* [Compare Won Revenue by Lead Source](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/chart/compare-won-revenue-by-lead-source.md): compare revenue shares with deal-count shares.
* [Compare Total and Average Deal Size](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/chart/compare-total-and-average-deal-size.md): distinguish sum and average measures over open pipeline.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/dynamic-components/tutorials/components/chart/measure-won-revenue-against-a-target.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
