> 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/flow/tutorials/components/kanban/introduction.md).

# Build an opportunity pipeline board with column totals

Build an opportunity board grouped by stage in a screen flow, with the total and average deal amount at the top of every column.

A sales manager reviews the quarter's deals every Monday. She wants the quarter's opportunities on one screen, one column per stage, and the value in each stage without opening a report. This board groups the cards by **Stage**, puts a total and an average amount in each column header, and lays the stages out left to right as a path.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FET6e0XjejXdASyrAFJCb%2Fkanban-kanban-overview.png?alt=media" alt="Opportunity Kanban in a screen flow, stages along a path, each column headed by a total and an average amount"><figcaption><p>This quarter's opportunities by stage, with a total and an average per column</p></figcaption></figure>

## Before you start

* The [Avonni Flow Screen Components](https://docs.avonnicomponents.com/flow/getting-started/installation-and-licenses-management.md) package is installed and you have its permission set.
* You have a screen flow open in Flow Builder. The board needs no flow variable: it reads the opportunities itself.

## Steps

{% stepper %}
{% step %}

### Add the Kanban to a screen

Open a **Screen** element, drag the Avonni **Kanban** onto it and click it to open its property editor. Keep the Kanban alone on this screen: a board needs the full width.
{% endstep %}

{% step %}

### Query the quarter's opportunities

In the **Properties** tab, set **Data Source** to **Query** and choose the object `Opportunity`.

Under **Filters**, click **Add Condition**: **Close Date** **Equals** `THIS_FISCAL_QUARTER`. The board rolls over to the next quarter on its own, with no edit to the flow.

The Kanban offers **Variable** and **Query** only. Query is the better fit for a board: it reads live records each time the screen loads, and the column totals cover every matching opportunity. [Query or Variable](https://docs.avonnicomponents.com/flow/component-builder/data-sources/query-vs-variable.md) compares the two.
{% endstep %}

{% step %}

### Group the cards by stage

In **Data Mappings**:

* **Key Field**: keep the default, the record Id (shown as **Id** in the property editor). The board uses it to know which record a card is, so it must be unique.
* **Group Field Name**: **Stage**. On Opportunity the builder fills it in for you.

Each picklist value of **Stage** becomes a column, in the order set on the field in Setup, including stages that hold no deal yet.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FIbbJEawA4dEi9YMju45p%2Fkanban-introduction-data-mappings.png?alt=media" alt="Kanban Data Mappings in the Flow property editor with Key Field, Group Field Name set to Stage and two Group Summaries on Amount" width="320"><figcaption><p>Group Field Name sets the columns, Group Summaries the totals in their headers</p></figcaption></figure>
{% endstep %}

{% step %}

### Choose what each card shows

Still in **Data Mappings**, open **Card**:

* **Title**: **Opportunity Name**.
* **Due Date**: **Close Date**.
* **Fields**: **Amount**, then the owner name. The field list opens related objects: expand the Owner to pick its name field.

Under **Card Fields Layout**, **Variant** defaults to **Label Hidden**. Switch it to **Label Inline** if your reps need to read "Amount" next to the number.
{% endstep %}

{% step %}

### Add a total and an average to every column

In **Data Mappings**, add two entries to **Group Summaries**:

| Setting                | First entry  | Second entry |
| ---------------------- | ------------ | ------------ |
| **Field**              | **Amount**   | **Amount**   |
| **Aggregate Function** | **Sum**      | **Average**  |
| **Prefix**             | `Total`      | `Avg`        |
| **Display As**         | **Currency** | **Currency** |

Under **Type Attributes**, set **Currency Code** to your org's currency, for example `USD`.

Totals count every opportunity that matches the query, including cards not loaded on screen. The property editor preview totals only the sample records it shows, so expect different numbers there.
{% endstep %}

{% step %}

### Switch to the Path variant

In the **Properties** tab, set **Variant** to **Path**. The stage names now run along the top as a chevron path, the same shape reps know from the opportunity record page, so the board reads from **Prospecting** to **Closed Won**. **Base** shows each stage as a separate column title, which suits a board whose columns have no natural order, such as Cases by type.

Turn on **Show Item Count** to add the number of deals beside each stage name. To change the path color, use **Path Background Color** under **Column Header** in the **Style** tab.
{% endstep %}

{% step %}

### Keep the stages in pipeline order

Leave **Column Order Direction** > **Direction** on **Default**: the columns follow the order of the **Stage** picklist. **Ascending Order** and **Descending Order** sort the columns by name, which would put **Closed Lost** before **Prospecting**. To hide a stage or set your own order, see [Filter, search and order a board](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/filter-search-and-order-a-board.md).
{% endstep %}

{% step %}

### Save and test

Save and run the flow. You should see:

* ten stage columns, from **Prospecting** to **Closed Lost**, with this quarter's opportunities as cards;
* a path along the top with the deal count beside each stage;
* `Total` and `Avg` amounts in each column header.

Cards can be dragged to another stage, and the Kanban saves the new stage on the record. To refuse a move or react to it, follow [Move a deal and save it safely](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/move-a-deal-and-save-it-safely.md). For a board people can look at but not change, turn on **Read Only**.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>The column totals do not appear</summary>

Check that each **Group Summaries** entry has a **Field**: it is required. If the field is set and the headers still show no total at runtime, the totals query failed, and the Kanban hides the totals when that happens. Remove the entries one by one to find the field that breaks it.

</details>

<details>

<summary>The numbers in the preview differ from the running flow</summary>

Expected. The property editor preview shows sample records and totals them. The running flow applies your query filters and totals every matching opportunity.

</details>

<details>

<summary>The stages are in alphabetical order</summary>

**Column Order Direction** > **Direction** is on **Ascending Order** or **Descending Order**. Set it back to **Default** to follow the picklist order.

</details>

## Related tutorials

* [Move a deal and save it safely](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/move-a-deal-and-save-it-safely.md): what happens when a rep drags a card, and how to stop a move a validation rule refuses.
* [Open a flow from a card action](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/open-a-flow-from-a-card-action.md): add a Reassign action to every card.
* [Group cards into swimlanes with totals](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/group-cards-into-swimlanes-with-totals.md): split each stage by lead source, with a total per lane.
* [Kanban](https://docs.avonnicomponents.com/flow/flow-components/kanban.md): every property, interaction and output of the component.


---

# 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/flow/tutorials/components/kanban/introduction.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.
