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.

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
Load the open deals
Select the Data Table on your screen and click Open Component Builder.
In the Properties tab, under Data Source, choose Query and pick the Opportunity object.
Add a filter so only open deals load, for example Closed equals
False.Add the columns Opportunity Name, Account Name, Stage, Amount and Close Date.
Group the rows by Stage
Still in the Properties tab, open Data Mappings.
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.

Put the stages in pipeline order
A forecast reads best when the sections follow the sales process.
Open the Group By section of the Properties tab.
Set Direction to Custom.
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.
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.
Add a total on Amount
In the preview, click the chevron on the Amount column header and choose Type Attributes.
Make sure Type is Currency.
Set Summarize By to Sum.
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.

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
Related tutorials
Work with Selected Rows: use the deals the manager ticked in the next element of the flow.
Activate infinite scrolling: load long lists in batches, the totals stay complete.
How to set column visibility: show or hide a column from a flow condition.
Was this helpful?
