> 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/group-cards-into-swimlanes-with-totals.md).

# Group cards into swimlanes with totals

Split each stage of an opportunity board into one swimlane per lead source, with a total per lane, so you see where this quarter's pipeline comes from.

A sales director wants to know which channels feed the pipeline: how much of the Proposal stage came from partners, and how much from the website. Swimlanes answer that on the board itself. Each stage column is split into one horizontal lane per **Lead Source**, and every lane header carries its own deal count and total amount.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fk9dJN75DzvzObqjMSQ7a%2Fkanban-group-cards-into-swimlanes-with-totals-result.png?alt=media" alt="Opportunity Kanban split into lead source swimlanes, each lane header with a deal count and a total amount"><figcaption><p>One lane per lead source, each with its own count and total</p></figcaption></figure>

## Before you start

* Build the pipeline board first: [Build an opportunity pipeline board with column totals](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/introduction.md). This page adds lanes to that board.
* Pick a **picklist** field for the lanes. The Kanban builds one lane per picklist value, the same way it builds one column per stage. A lookup such as **Owner** or a text field gives no lanes.

## Steps

{% stepper %}
{% step %}

### Choose the lane field

Open the Kanban in the property editor. In **Data Mappings**, set **Sub Group Field Name** to **Lead Source**.

The board now shows one lane per Lead Source value (Web, Partner, Trade Show and so on) inside every stage column. If the field depends on a record type, set **Sub Group Field Record Type** so only that record type's values become lanes.
{% endstep %}

{% step %}

### Add a total to each lane

Under **Sub Group Summaries**, add one entry:

* **Field**: **Amount**
* **Aggregate Function**: **Sum**
* **Prefix**: `Total`
* **Display As**: **Currency**, with your **Currency Code** under **Type Attributes**

**Sub Group Summaries** works exactly like **Group Summaries**: same functions, same formats. The column totals you set in the first tutorial stay at the top of each stage; the lane totals sit in each lane header.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FohmmALHzSrOiB0ySz9dH%2Fkanban-group-cards-into-swimlanes-with-totals-sub-group-mapping.png?alt=media" alt="Sub Group Field Name set to Lead Source and a Sub Group Summaries entry summing Amount" width="320"><figcaption><p>Sub Group Field Name creates the lanes, Sub Group Summaries their totals</p></figcaption></figure>
{% endstep %}

{% step %}

### Count the deals in each lane

In the **Properties** tab, turn on **Show Subgroup Item Count**. Each lane header shows its number of cards in parentheses. **Show Item Count** does the same for the stage columns.
{% endstep %}

{% step %}

### Decide which lanes appear and how they open

Open the **Group By** section:

* **Hide Undefined Group**: Lead Source is optional, so the Kanban adds a lane for deals with no source. Rename it with **Undefined Group Label** (for example `No source`), or turn this on to remove it. The same setting also controls the undefined column, which never appears for **Stage** because Stage is required.
* **Collapsed**: every lane starts closed, showing only its header and totals. Users click a lane header to open it. Useful once you have more than four or five lanes.
* **Show Empty Sub Groups**: by default a lane with no card at all is hidden. Turn it on to keep every lead source on the board, so the director sees the empty channels too. Empty lanes open collapsed.
  {% endstep %}

{% step %}

### Save and test

Save and run the flow. You should see:

* each stage column divided into lanes, one per lead source;
* a deal count and a `Total` amount in every lane header, under the column totals;
* only lanes that hold deals, unless **Show Empty Sub Groups** is on.

Drag a card to another stage in the same lane: only its stage changes. Drag it into a different lane and the Kanban saves the new **Lead Source** on the record as well, so keep **Read Only** on if the board is for review only.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>No lanes appear</summary>

**Sub Group Field Name** points to a field that is not a picklist, such as **Owner** (a lookup) or a text field. Lanes come from the picklist values of the field. Use a picklist field, or create one if you need lanes per rep or per region.

</details>

<details>

<summary>A lead source is missing from the lanes</summary>

No deal in the board's query has that value, and empty lanes are hidden. Turn on **Show Empty Sub Groups** in the **Group By** section.

If deals carry the value but their cards are missing too, the value is not (or no longer) an active value of the Lead Source picklist. The Kanban draws lanes from the picklist's values only, so those cards are not shown, while the column counts and totals still include them. Add the value back to the picklist in Setup, or update those records to an active value.

</details>

<details>

<summary>Moving a card changed its Lead Source</summary>

Expected. A card dropped into another lane takes that lane's value, and the Kanban saves it with the stage. Drag along the same lane to change the stage only.

</details>

## Related tutorials

* [Build an opportunity pipeline board with column totals](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/introduction.md): the board this page starts from.
* [Filter, search and order a board](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/filter-search-and-order-a-board.md): narrow the same board to one deal type or one lead source.
* [Move a deal and save it safely](https://docs.avonnicomponents.com/flow/tutorials/components/kanban/move-a-deal-and-save-it-safely.md): stop a move a validation rule refuses.


---

# 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/group-cards-into-swimlanes-with-totals.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.
