How to add field calculations to the table footer

This functionality requires the Math by GravityView plugin version 2.0 installed and activated on your website.

Introducing in version 2.0 of Math by GravityView there's a new functionality that allows our users to easily perform calculations (Lowest, Highest, Average, Sum, and others) to an entire column of the View without having to write the [gv_math] shortcode.

We will be starting with a very basic form and View containing only two types of fields: a Single Line Text and a Number field.

A simple View with two columns, one is Name and the other is Age

Now, let's calculate the Lowest age in that View. 

1) On the View editor, click the cog icon to access the Age field modal screen:

Screenshot of the View editor showing the Entries Fields section with two fields added: Name and Age

2) Once the field configuration modal shows up, click on the option "Add field calculations to the table footer?":

Screenshot of field modal configuration showing the new option "Add field calculations to the table footer?"

3) That checkbox once clicked shows three additional options:

Screenshot of the "Add field calculations..." setting in the field modal screen

3.1) "Label" allows us to write a custom text to show up on the table footer. Let's try "The youngest age is:"

Screenshot of the "Add field calculations..." setting highlighting the Label input3.2) "Calculation Source" defines where the data will come from.

3.3) "Calculation Type" allows us to select which calculation are we going to perform with the values of that field (column).

Here's the final output in our View:

Screenshot of the View with two columns Name and Age and showing an additional row for the Age column with the youngest age shown

We can also perform other calculations, like a sum of all ages:

Screenshot of the "Add field calculations..." setting highlight the Calculation Type dropdown

Screenshot of the View with two columns Name and Age and displaying a new row under the Age column with the sum of the total ages combined

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.