> 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/premium-table/formula-syntax/time-intelligence-functions.md).

# Time intelligence functions

<table><thead><tr><th width="264">NAME</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/aggregate.md">AGGREGATE</a></td><td>Performs a specific aggregation like min/max/avg/sum on a measure over a specified time range</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/column_period.md">COLUMN_PERIOD</a></td><td>Returns the start/end/previous or next time period</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/filter.md">FILTER</a></td><td>Filters measure values across a period range and returns only those values that satisfy specified conditions</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/lastnday.md">LASTNDAY</a></td><td>Returns data for last n days</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/lastnmonth.md">LASTNMONTH</a></td><td>Returns data for last n months</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/lastnqtr.md">LASTNQTR</a></td><td>Returns data for last n quarters</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/lastnyear.md">LASTNYEAR</a></td><td>Returns data for last n years</td></tr><tr><td><a href="/premium-table/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="/premium-table/formula-syntax/time-intelligence-functions/movingaverage.md">MOVINGAVERAGE</a></td><td>Returns the average of a measure over a specified date range.</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/movingsum.md">MOVINGSUM</a></td><td>Returns the sum of a measure over a specified date range.</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/mtd.md">MTD</a></td><td>Returns data for the current month(s) till date </td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/nextnday.md">NEXTNDAY</a></td><td>Returns data for next n days</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/nextnmonth.md">NEXTNMONTH</a></td><td>Returns data for next n months</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/nextnqtr.md">NEXTNQTR</a></td><td>Returns data for next n quarters</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/nextnyear.md">NEXTNYEAR</a></td><td>Returns data for next n years</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/qtd.md">QTD</a></td><td>Returns data for the current quarter(s) till date</td></tr><tr><td><a href="/premium-table/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="/premium-table/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="/premium-table/formula-syntax/time-intelligence-functions/totalytd.md">TOTALYTD</a></td><td>Evaluates the year-to-date value of the measure in the current context</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/totalqtd.md">TOTALQTD</a></td><td>Evaluates the quarter-to-date value of the measure in the current context</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/totalmtd.md">TOTALMTD</a></td><td>Evaluates the month-to-date value of the measure in the current context</td></tr><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/yearperiod.md">YEARPERIOD</a></td><td>Returns data for a year based on the input years passed</td></tr><tr><td><a href="/premium-table/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><tr><td><a href="/premium-table/formula-syntax/time-intelligence-functions/ytd.md">YTD</a></td><td>Returns data for the current year(s) till date</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/premium-table/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.
