Table of Contents
How to show totals, averages, minimum and maximum in wpDataTables
Say your stock table lists 40 products, and you want the total number of items in stock and the lowest stock level right below the table. wpDataTables calculates the sum, average, minimum and maximum of integer and float columns and shows them in a row at the bottom of the table. The results update when visitors filter the table, so a filtered table shows the totals of the visible rows. You can add them with Tabella AI or in the column settings.
How do I add totals with Tabella AI?
Open the table, click Ask Tabella AI and name the column and the calculation.
- Open the table. Go to wpDataTables → wpDataTables and click the table title.
- Ask Tabella AI. Click Ask Tabella AI and type, for example: Show the total of the Stock column below the table.
- Check and save. Tabella AI lists what it changed, for example Column “Stock”: total: enabled. Totals show after you click Save Changes and reload the editor. Click Undo table changes to go back instead.
How do I add totals in the column settings?
Turn on the calculations you need in the Data tab of an integer or float column and save the table.
- Open the table. Go to wpDataTables → wpDataTables and click the table title.
- Open the column settings. In the table preview, click the settings icon in the header of the number column.
- Choose the calculations. In the Data tab, turn on Calculate a total for this column under Calculate total, Calculate average for this column under Calculate average, Find a minimum value for this column under Calculate MIN value or Find a maximum value for this column under Calculate MAX value.
- Save the table. Click Save Changes. The results show in a row at the bottom of the table.

How do I show a result outside the table?
Copy the shortcode shown below each calculation you turned on in the Data tab, with the copy icon next to it, and paste it into a post, a page or a cell of another table. A sum shortcode looks like this:
[wpdatatable_sum table_id=12 col_id=34 value_only=0]
The shortcodes for the other results are wpdatatable_avg, wpdatatable_min and wpdatatable_max. Two optional parameters work with all of them:
| Parameter | What it does | Example |
|---|---|---|
label |
Replaces the default label in front of the value. | label="Items in stock" |
value_only |
1 shows only the number, without the label and the HTML around it. 0 (in the copied shortcode) shows the label too. |
value_only=1 |
To use a shortcode inside a cell of another table, turn on Parse shortcodes (Parse shortcodes in strings) in wpDataTables → Settings → Main settings. You can also use the results in formula columns.
What should I remember about calculations?
Ask Tabella AI, or turn on Calculate total, Calculate average, Calculate MIN value or Calculate MAX value in the Data tab of a number column, to add a results row below the table. The results follow the filters. Copy the shortcode of a result to show it elsewhere, with label and value_only to change how it looks.
Where can I read more?
These pages cover number columns and calculations: