Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Group rows and show totals

Group the rows of a screen flow Data Table by a field such as Stage, then add a subtotal per group and a grand total at the bottom of the table.

A sales manager opens a screen flow to review the open pipeline before the weekly forecast call. A flat list of forty deals hides the question that matters: how much money sits in each stage. Grouping the Data Table by Stage puts each stage in its own collapsible section, and a Sum on Amount gives a subtotal per stage plus a grand total for the whole pipeline.

A Data Table of open opportunities grouped by stage, each group showing its row count and a Sum subtotal of Amount, with a grand total row at the bottom
Open deals grouped by stage, with a subtotal per stage and a grand total.

Before you start

  • A screen flow with the Avonni Data Table on a screen. If you have never set one up, start with Learn the Basics.

  • A data source that returns open Opportunities with Opportunity Name, Account Name, Stage, Amount and Close Date. This page uses a Query data source. A Get Records collection (Variable) works too.

  • The field you group by must be part of the rows the table receives. With a Variable data source, make sure your Get Records element stores it.

Steps

1

Load the open deals

  1. Select the Data Table on your screen and click Open Component Builder.

  2. In the Properties tab, under Data Source, choose Query and pick the Opportunity object.

  3. Add a filter so only open deals load, for example Closed equals False.

  4. Add the columns Opportunity Name, Account Name, Stage, Amount and Close Date.

2

Group the rows by Stage

  1. Still in the Properties tab, open Data Mappings.

  2. In Group By, select Stage.

The preview now shows one section per stage value. With a Query source the list only offers fields Salesforce can group on (a picklist like Stage, not a long text area). With a record collection, any field of the object is available.

The Group By section of the Data Table Properties tab with Display Group Rows Count turned on and Direction set to Custom
The Group By section, with the stages in a custom order.
3

Put the stages in pipeline order

A forecast reads best when the sections follow the sales process.

  1. Open the Group By section of the Properties tab.

  2. Set Direction to Custom.

  3. In Group By Custom Order, list the stages in the order you want: Prospecting, Qualification, Needs Analysis, Value Proposition, Proposal/Price Quote, Negotiation/Review.

Ascending Order and Descending Order sort the sections by their value instead. Default keeps the order of the data.

4

Choose how the groups behave

In the same Group By section, two settings shape the forecast view:

  • Display Group Rows Count shows the number of deals next to each stage. Turn it on.

  • Collapsed opens the screen with every group closed, one line per stage. Leave it off here.

The other options (empty groups, the blank group, the grand total, links on lookup groups) are listed in the Data Table reference.

5

Add a total on Amount

  1. In the preview, click the chevron on the Amount column header and choose Type Attributes.

  2. Make sure Type is Currency.

  3. Set Summarize By to Sum.

  4. Optional: turn on Treat Blank Values As Zero if a deal without an amount must count in an Average or a Count.

Summarize By exists on Currency, Number and Percent columns, with three choices: Sum, Average and Count. Without Group By, the same setting adds a single total row under the table.

Type Attributes of the Amount column scrolled to Summarize By set to Sum, with Treat Blank Values As Zero turned off
Summarize By on the Amount column adds the subtotals and the grand total.
6

Save and test

Click Done, save the flow and run it with Debug (or from the page that launches it).

You should see one section per stage, in your custom order, each header showing the stage, its row count and its subtotal (for example "Sum $192,000.00"), and a grand total row under the last stage. Selecting rows still works across groups: the table's Selected Rows output holds every checked deal when the user clicks Next.

Good to know

  • With a Query data source, subtotals and the grand total are calculated over all the records that match the query, not only the rows loaded so far. They stay right with pagination or infinite scrolling.

  • Blank amounts are skipped in an Average or a Count, unless Treat Blank Values As Zero is on.

  • In a multi-currency org, the totals add the raw amounts without converting them. Filter the query on one currency (CurrencyIsoCode) before you sum Amounts in different currencies.

Troubleshooting

The total row says "Sum" and I need another word

The row label is fixed: Sum, Avg or Count, in English, depending on the Summarize By choice. There is no setting to rename it today. If the label matters, rename the column instead, for example Amount (total per stage).

Stage does not appear in the Group By list

With a Variable data source, the list offers the fields of the collection: check that your Get Records element stores Stage.

No subtotal appears

Summarize By only shows for Currency, Number and Percent columns. If Amount was added as Text, change its Type to Currency first.

Was this helpful?