> For the complete documentation index, see [llms.txt](https://docs.inforiver.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inforiver.com/formula-syntax/time-intelligence-functions.md).

# Time intelligence functions

<table><thead><tr><th width="226.22216796875">NAME</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><a href="/formula-syntax/time-intelligence-functions/aggregate.md">AGGREGATE</a></td><td>Performs the specified aggregation like minimum/maximum/average/sum on a measure over a specified time range.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/column_period.md">COLUMN_PERIOD</a></td><td>Returns the start, end, previous, or next time period as specified.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/filter.md">FILTER</a></td><td>Filters measure values across a period range that meet specified conditions.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/lastnday.md">LASTNDAY</a></td><td>Used to filter data for the last <em>n</em> days before the current date.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/lastnmonth.md">LASTNMONTH</a></td><td>Used to filter data for the last <em>n</em> months before the current month.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/lastnqtr.md">LASTNQTR</a></td><td>Used to filter data for the last <em>n</em> quarters before the current quarter.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/lastnyear.md">LASTNYEAR</a></td><td>Used to filter data for the last <em>n</em> years before the current year.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/monthperiod.md">MONTHPERIOD</a></td><td>Returns data for a month based on the year and month number.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/qtrperiod.md">QTRPERIOD</a></td><td>Returns data for a range of quarters based on the year and quarter number.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/yearperiod.md">YEARPERIOD</a></td><td>Returns data for the year(s) based on the input years passed.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/nextnday.md">NEXTNDAY</a></td><td>Used to filter data for the next <em>n</em> days after the current date.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/nextnmonth.md">NEXTNMONTH</a></td><td>Used to filter data for the next <em>n</em> months after the current month.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/nextnqtr.md">NEXTNQTR</a></td><td>Used to filter data for the next <em>n</em> quarters after the current quarter.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/nextnyear.md">NEXTNYEAR</a></td><td>Used to filter data for the next <em>n</em> years after the current year.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/mtd.md">MTD</a></td><td>Month-to-Date. Returns data from the 1st of the current month through the current date. An offset can be used to include data from the past months.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/qtd.md">QTD</a></td><td>Quarter-to-Date. Returns data from the 1st of the current quarter to the current date. An offset can be used to include data from the past quarters.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/ytd.md">YTD</a></td><td>Year-to-Date. Returns data from the start of the current year to the present date. An offset can be used to include data from the past years.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/movingaverage.md">MOVINGAVERAGE</a></td><td>Returns the moving average of a measure over a specified date range.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/movingsum.md">MOVINGSUM</a></td><td>Returns the moving sum of a measure over a specified date range.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/shift.md">SHIFT</a></td><td>Returns the date after shifting a date either backwards or forwards by a specified time period.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/totalmtd.md">TOTALMTD</a></td><td>Evaluates the month-to-date value of the measure in the current context. Returns data from the start of the current month up to the present date. </td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/totalqtd.md">TOTALQTD</a></td><td>Evaluates the quarter-to-date value of the measure in the current context. Returns data from the start of the current calendar or fiscal quarter up to the present date. </td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/totalytd.md">TOTALYTD</a></td><td>Evaluates the year-to-date value of the measure in the current context. Returns data from the start of the current calendar or fiscal year (e.g., January 1) up to the present date.</td></tr><tr><td><a href="/formula-syntax/time-intelligence-functions/valueat.md">VALUEAT</a></td><td>Returns the value of a measure for a specified date or a date shift relative to the current column.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.inforiver.com/formula-syntax/time-intelligence-functions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
