> 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/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions.md). Agents can also search and read this documentation through its [MCP server](https://docs.inforiver.com/~gitbook/mcp).

# Time intelligence functions

<table><thead><tr><th width="264">NAME</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/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="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions/lastnday.md">LASTNDAY</a></td><td>Returns data for last n days</td></tr><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions/lastnmonth.md">LASTNMONTH</a></td><td>Returns data for last n months</td></tr><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions/lastnqtr.md">LASTNQTR</a></td><td>Returns data for last n quarters</td></tr><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions/lastnyear.md">LASTNYEAR</a></td><td>Returns data for last n years</td></tr><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/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="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/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="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions/nextnday.md">NEXTNDAY</a></td><td>Returns data for next n days</td></tr><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions/nextnmonth.md">NEXTNMONTH</a></td><td>Returns data for next n months</td></tr><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions/nextnqtr.md">NEXTNQTR</a></td><td>Returns data for next n quarters</td></tr><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/formula-syntax/time-intelligence-functions/nextnyear.md">NEXTNYEAR</a></td><td>Returns data for next n years</td></tr><tr><td><a href="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/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="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/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="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/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="https://docs.inforiver.com/~/changes/mS6jwvARNLHpKqBa4cT9/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/~/changes/mS6jwvARNLHpKqBa4cT9/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.
