Please wait...

Calculating totals, minimum, maximum and average values in WordPress Tables

Video versionA video overview of responsive tables in wpDataTables

Sum/Totals row in wpDataTablesHow to show totals for numeric columns in tables

For many cases it is useful to calculate a sum, average, minimum and maximum of all of the values for a given column. E.g. total sales within a month, total price of products in an order, calculating maximum profit, minimum wage, average grade etc. wpDataTables supports a sum / totals, average, minimum and maximum row for numeric columns, e.g. see this table (try to filter it by a date range to see how the totals recalculate):

Adding all of this features is very simple. In column settings click on Data tab and just check the Calculate checkboxes for that selected column that you want to calculate this functions.

Calculation functions

If this checkboxes are checked for at least one row, functions row will appear in the bottom.
Functions are recalculated on table redraw (i.e. when you filter).

Also you can notice the shortcode below each calculate function.

Calculating shortcode

By pasting the shortcode you can display the results of the functions somewhere outside of the table or you can paste this code in some cell of another table.
To be able to achieve this you will need to check Parse shortcodes option on wpDatatables Settings page.

Calculating shortcode2
  1. Go to WordPress admin, and open wpDataTables
  2. Click on Settings
  3. Check the “Parse shortcodes” checkbox

Never miss new features!

Join 2000+ newsletter subscribers

Never miss notifications about new cool features, promotions, giveaways or freebies - subscribe to our newsletter! We send about one mail per month, and do our best to keep our announcements interesting.

We never spam or disclose your address to anyone.