Skip to content
GravityKit
Buy
Sign in
0 items
  • Plugins

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Formsโ€”everything you need to build powerful web apps and workflows.

    Learn more
    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, or PDF and share them instantly with secure download links.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data, including forms, entries, Views, feeds, uploads, and more.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

  • Ideal For

    • Nonprofits
    • Startups
    • Education
    • Web Agencies
    • Developers
    • Government iconGovernment
    Explore All Use Cases

    Case studies

    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    View All Case Studies
  • Resources

    • Blog
    • Case studies
    • Support
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy
    • GravityKit Live!

    Ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Plugins

    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, or PDF and share them instantly with secure download links.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data, including forms, entries, Views, feeds, uploads, and more.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Formsโ€”everything you need to build powerful web apps and workflows.

    Learn more
  • Ideal For

    • Nonprofits
    • Startups
    • Education
    • Web Agencies
    • Developers
    • Government iconGovernment
    Explore All Use Cases

    Case studies

    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    • Mediebruket
    • Dragonfly
    View All Case Studies

    How to build...

    • Property Management
    • Product Catalog
    • Fundraising Dashboard
    • Real Estate Directory
    • Document Library
    • Academic Journal
    • Volunteer Management
    • Meal Tracker
    View All Guides
  • Resources

    • Blog
    • Case studies
    • Support
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy
    • GravityKit Live!

    ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Pricing
  • About
0 items

Search

Results appear automatically as you type.
Loading results…

results found matching

    Sign in
    Buy

    Docs

    • Docs Home

    Gravity Forms Add-Ons

    • GravityView
    • GravityActions
    • GravityBoard
    • GravityCalendar
    • GravityCharts
    • GravityEdit
    • GravityExport
    • GravityImport
    • GravityMath
    • GravityMigrate
    • GravityRevisions
    • GF Widget for Elementor
    • GF Dynamic Lookup
    • GF Entry Tags
    • GF Event Field
    • GF Zero Spam
    • GravityExport Lite

    GravityView

    • Getting Started
    • View Setup
    • FAQ
    • Pre-Sale
    • Advanced
    • Common Problems
    • Customizing Your Views
    • Edit Entry
    • Entry Approval
    • Filter and Sort Results
    • Gravity Forms
    • Merge Tags
    • Roles and Capabilities
    • Search
    • Shortcodes
    • View Settings
    • WordPress Posts

    General Help

    • Account, Invoices, and Billing
    • License Related
    • Plugins and Settings
    • Contact
    • Docs Home
    • Gravity Forms Add-Ons

      • GravityView
      • GravityActions
      • GravityBoard
      • GravityCalendar
      • GravityCharts
      • GravityEdit
      • GravityExport
      • GravityImport
      • GravityMath
      • GravityMigrate
      • GravityRevisions
      • GF Widget for Elementor
      • GF Dynamic Lookup
      • GF Entry Tags
      • GF Event Field
      • GF Zero Spam
      • GravityExport Lite
    • GravityView

      • Getting Started
      • View Setup
      • FAQ
      • Pre-Sale
      • Advanced
      • Common Problems
      • Customizing Your Views
      • Edit Entry
      • Entry Approval
      • Filter and Sort Results
      • Gravity Forms
      • Merge Tags
      • Roles and Capabilities
      • Search
      • Shortcodes
      • View Settings
      • WordPress Posts
    • General Help

      • Account, Invoices, and Billing
      • License Related
      • Plugins and Settings
    • Contact

    GravityMath

    • Add calculations to blog posts
    • Calculating Survey fields totals based on their scoring
    • Calculations in GravityView
    • Can GravityMath be used inside a Gravity Forms form?
    • Can I use [gravitymath] with [gvlogic]?
    • Can I use [gravitymath] with dates and times?
    • Can I use [gravitymath] with Multiple Forms?
    • Debugging Calculations in GravityMโ€‹ath
    • Developer Hooks for GravityMath
    • Does GravityMath support the Polls Add-on?
    • Does GravityMath support the Survey Add-on?
    • GravityMath Calculation field
    • How to add field calculations to the table footer
    • How to Calculate the Sum of a Field in Gravity Forms
    • How to display summaries using a block, widget, or shortcode
    • How to enable duration calculations in Gravity Forms with GravityMath
    • How to perform Gravity Forms time calculations in GravityView using GravityMath
    • Math filters: How to target a specific field value with [gravitymath] filters
    • Nested calculations in GravityMath
    • Pricing fields calculation
    • Sum GravityMath values for today, a custom date range, or a rolling window
    • The [gravitymath] Shortcode
    • The {entry_count} Merge Tag in Math by GravityView
    • Using GravityMath inside a GravityView Custom Content field
    • When to use GravityMath and when to use GP Advanced Calculations
    • Home
    • Docs
    • GravityMath
    • Sum GravityMath values for today, a custom date range, or a rolling window

    Sum GravityMath values for today, a custom date range, or a rolling window

    Estimated reading: 5 minutes

    Updated on April 24, 2026

    Use this pattern when you need the sum of a field’s values over a specific time period โ€” for example, “total revenue entered today” or “total hours logged between 2026-04-15 and 2026-04-20.” The [gravitymath] ย shortcode’s filter ย parameter only accepts one condition per field, so you can’t express “between two dates” directly. Instead, you nest two shortcodes and subtract.

    Before you start #

    • You need GravityMath installed and activated.
    • You should be comfortable with the [gravitymath] ย shortcode and its filter ย parameter. If you aren’t, start with The [gravitymath] Shortcode and Math filters: How to target a specific field value.
    • You should be using scope="form" ย or scope="view" ย โ€” the filter ย parameter only works with those two scopes.

    Why you need two shortcodes #

    The filter ย parameter can only hold one condition per field. You cannot write filter_date_created=2026-04-15&filter_date_created=2026-04-20 ย and have GravityMath interpret that as a range โ€” the second condition overwrites the first.

    The workaround is to compute two running totals and subtract them:

    1. The sum of all entries created before the end boundary.
    2. The sum of all entries created before the start boundary.

    Subtracting (1) minus (2) leaves only the entries inside the range.

    Both sums use op_date_created=lt ย (“less than”), which excludes the boundary itself. Because lt ย is exclusive, the end boundary must be the day after the last date you want to include.

    Sum only today’s entries #

    This example sums field ID 6 ย for all entries submitted today, based on each entry’s creation date. Replace id="4" ย with your form ID and {Your Field:6} ย with the merge tag for the field you’re summing.

    [gravitymath]
    [gravitymath2 scope="form" id="4" filter="filter_date_created=tomorrow&op_date_created=lt"] {Your Field:6} [/gravitymath2]
    -
    [gravitymath2 scope="form" id="4" filter="filter_date_created=today&op_date_created=lt"] {Your Field:6} [/gravitymath2]
    [/gravitymath]

    How this works:

    • The first inner shortcode sums every entry created before tomorrow (midnight) โ€” i.e. everything up to and including today.
    • The second inner shortcode sums every entry created before today (midnight) โ€” i.e. everything from yesterday and earlier.
    • The outer [gravitymath] ย subtracts the second from the first, leaving only entries created today.

    The today ย and tomorrow ย tokens resolve to midnight on their respective days, so the math lines up cleanly at the day boundary.

    Sum entries between two specific dates #

    Use this pattern when you need a fixed date range โ€” for example, a monthly report or a custom reporting window. This example covers 2026-04-15 through 2026-04-20 inclusive:

    [gravitymath]
    [gravitymath2 scope="form" id="4" filter="filter_date_created=2026-04-21&op_date_created=lt"] {Your Field:6} [/gravitymath2]
    -
    [gravitymath2 scope="form" id="4" filter="filter_date_created=2026-04-15&op_date_created=lt"] {Your Field:6} [/gravitymath2]
    [/gravitymath]

    Note two things:

    • The end boundary is 2026-04-21, not 2026-04-20. Because lt ย is exclusive, you need to pass the day after your last included date.
    • The start boundary is 2026-04-15 โ€” the first date you want to include. lt 2026-04-15 ย excludes entries from that day, which is then cancelled out because those entries are also excluded from the end-boundary total.

    Date format: use YYYY-MM-DD #

    When passing explicit dates into the filter ย parameter, use YYYY-MM-DD ย format (e.g. 2026-04-21 ). Other formats such as d/m/Y ย (e.g. 21/04/2026 ) may not parse reliably, even when that format is what your form’s date field displays to users. The filter_date_created ย comparison runs against the stored entry timestamp, not the displayed format.

    The today ย and tomorrow ย relative tokens also work and resolve to midnight of the matching day.

    Filtering by a date field in the form, not the submission date #

    The examples above filter on filter_date_created , which is Gravity Forms’ built-in entry creation timestamp. If you want to filter on a date field inside the form itself (for example, an “Event date” field with ID 12 ), swap the key:

    filter="filter_12=2026-04-21&op_12=lt"

    Use the field ID in place of date_created , and date values in YYYY-MM-DD ย format.

    Troubleshooting #

    Symptom: The shortcode outputs 0 ย or a blank value.

    Cause: Most often the date format. The filter ย parameter silently fails when it can’t parse the date.

    Fix: Re-enter the date in YYYY-MM-DD ย format. If it still fails, enable GravityMath debugging to see how the shortcode is being parsed.

    Symptom: The result is off by one day’s worth of entries.

    Cause: The end boundary is set to the last day you want included, not the day after.

    Fix: Because op_date_created=lt ย excludes the boundary, the end date must be the day after your last included date. For “through 2026-04-20,” use 2026-04-21 .

    Symptom: The filter parameter is ignored entirely.

    Cause: Missing or incorrect scope set.

    Fix: The filter ย parameter only works with scope="form" ย or scope="view" . Pick one and specify the matching form or View id .

    Related #

    • Math filters: How to target a specific field value โ€” full filter ย syntax reference, including operators and multi-field conditions.
    • Nested calculations in GravityMath โ€” the nesting pattern this article builds on.
    • How to Calculate the Sum of a Field in Gravity Forms โ€” the starting point if you just need a running total with no date filtering.
    • The [gravitymath] Shortcode โ€” full shortcode attribute reference.
    Still stuck? How can we help?

    How can we help?

    "*" indicates required fields

    This field is for validation purposes and should be left unchanged.
    Replies will go to this email.
    How can we help?*
    My pre-sale question is related to...*
    My WordPress skills are....*
    My Gravity Forms skills are...*
    You will be shown articles from our documentation.
    Vous pouvez nous รฉcrire dans votre langue maternelle si cโ€™est plus facile pour vousโ€”nous nous occuperons de la traduction!
    Puedes escribirnos en tu idioma nativo si te resulta mรกs fรกcil; ยกnosotros nos encargamos de la traducciรณn!
    Sie kรถnnen uns in Ihrer Muttersprache schreiben, wenn das fรผr Sie einfacher ist โ€“ wir kรผmmern uns um die รœbersetzung!
    U kunt ons in uw moedertaal schrijven als dat gemakkelijker voor u is โ€” wij zorgen voor de vertaling!
    Du kan skrive til oss pรฅ ditt morsmรฅl hvis det er enklere for deg โ€” vi tar oss av oversettelsen!
    Du kan skriva till oss pรฅ ditt modersmรฅl om det รคr lรคttare fรถr dig โ€” vi tar hand om รถversรคttningen!
    Vocรช pode nos escrever em seu idioma nativo se for mais fรกcil para vocรช โ€” nรณs cuidaremos da traduรงรฃo!
    Puoi scriverci nella tua lingua madre se ti รจ piรน facile โ€” penseremo noi alla traduzione!
    Please provide as much detail as you're able; this helps us provide you with faster support.
    Drop files here or
    Accepted file types: jpg, jpeg, gif, png, tiff, pdf, bmp, zip, json, csv, xls, xlsx, Max. file size: 256 MB.
      Stay informed?

      Was this page helpful?

      Table Of Contents
      • Before you start
      • Why you need two shortcodes
      • Sum only today’s entries
      • Sum entries between two specific dates
      • Date format: use YYYY-MM-DD
      • Filtering by a date field in the form, not the submission date
      • Troubleshooting
      • Related
      GravityKit
      • How to Build It
      • Pricing
      • Products
      • Our Team
      • Our Values
      • Work With Us
      • Coupons
      Support
      • Support
      • Contact
      • Documentation
      • Scope of Support
      • Brand Guidelines
      • Privacy Policy
      • Terms of Service (โ€œTermsโ€)
      About Us
      • GravityKit on Mastodon
      • GravityKit on Twitter
      • GravityKit Training Courses
      • GravityKit on Facebook
      • Join our Facebook Group
      • Facebook
      • Twitter
      Get notified of updates.

      Weโ€™re constantly improving GravityKit. Fill out your email below and weโ€™ll notify you anytime major updates drop.

      GravityKit is a Gravity Forms Certified Developer.

      Copyright ยฉ 2026, Katz Web Services, Inc.

      GravityKit and GravityView are registered trademarks of Katz Web Services, Inc.