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

# Period-to-date calculations

Plan supports period-to-date functions that retrieve data from the beginning of the current month, quarter, or year up to the current period. These functions help you calculate cumulative values and analyze performance over a defined time period.

### MTD

The *MTD* function returns data for the current month. If an offset is specified, the function also returns data for the specified number of preceding months. Use this function with an aggregate function, such as `SUM` or `AVERAGE`, to calculate values over the returned date range.

#### Syntax

```
MTD(measure, [offset])
```

#### Arguments

* `measure`: The measure for which data is returned.
* `offset` (optional): The number of preceding months to include along with the current month.

#### Return value

Returns the specified measure for the current month or for the current month and the specified number of preceding months.

#### Examples

```
MTD([Sales])
```

Returns the *Sales* data for the current month.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FzZfd0sBWBcK9PcKToSDI%2Fimage.png?alt=media&amp;token=c7f99b61-aa7f-4979-8134-8e87d1ef308b" alt=""><figcaption></figcaption></figure>

```
MTD([Sales],2)
```

Returns the *Sales* data for the current month and the preceding two months.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FwoQQzNYxuMJvwwhmSVcS%2Fimage.png?alt=media&amp;token=88a1b69d-8377-42f7-81b9-897624a62abf" alt=""><figcaption></figcaption></figure>

### QTD

The *QTD* function returns data for the current quarter. If an offset is specified, the function also returns data for the specified number of preceding quarters. Use this function with an aggregate function, such as `SUM` or `AVERAGE`, to calculate values over the returned date range.

#### Syntax

```
QTD(measure, [offset])
```

#### Arguments

* `measure`: The measure for which data is returned.
* `offset` (optional): The number of preceding quarters to include along with the current quarter.

#### Return value

Returns the specified measure for the current quarter or for the current quarter and the specified number of preceding quarters.

#### Examples

```
QTD([Sales])
```

Returns the *Sales* data for the current quarter.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2F418tunuXMUHILPYgCPL4%2Fimage.png?alt=media&amp;token=980505c0-b641-40aa-9c1d-4219e939ff0f" alt=""><figcaption></figcaption></figure>

```
QTD([Sales],3)
```

Returns the *Sales* data for the current quarter and the preceding three quarters.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fi30Wc7O7BzC7B5zhALt6%2Fimage.png?alt=media&amp;token=1d2cce43-d2bb-494a-8008-b2e97f06a5f2" alt=""><figcaption></figcaption></figure>

### YTD

The *YTD* function returns data for the current year. If an offset is specified, the function also returns data for the specified number of preceding years. Use this function with an aggregate function, such as `SUM` or `AVERAGE`, to calculate values over the returned date range.

#### Syntax

```
YTD(measure, [offset])
```

#### Arguments

* `measure`: The measure for which data is returned.
* `offset` (optional): The number of preceding years to include along with the current year.

#### Return value

Returns the specified measure for the current year or for the current year and the specified number of preceding years.

#### Examples

```
YTD([Sales])
```

Returns the *Sales* data for the current year.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FeVmagR1jf6feum6djGef%2Fimage.png?alt=media&amp;token=5d22b98f-8a32-4f68-b779-5cf9dda82cff" alt=""><figcaption></figcaption></figure>

```
YTD([Sales],2)
```

Returns the *Sales* data for the current year and the preceding two years.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FAXlJ8CkY09sVYBStl6EW%2Fimage.png?alt=media&amp;token=2288cace-d1a0-4f4e-8348-aec703d3a2d6" alt=""><figcaption></figcaption></figure>

### TOTALMTD

The *TOTALMTD* function returns the month-to-date value of a measure in the current context. Use this function with an aggregate function, such as `SUM` or `AVERAGE`, to calculate cumulative values for the current month.

#### Syntax

```
TOTALMTD(measure)
```

#### Arguments

* `measure`: The measure for which the month-to-date value is returned.

#### Return value

Returns the month-to-date values for the specified measure. When used with an aggregate function, it returns a cumulative value from the beginning of the current month up to the current period.

#### Example

The following formula returns the cumulative *Sales* value for each day in the current month.

```
SUM(TOTALMTD([Sales]))
```

For example, on **January 4**, the result is the sum of the *Sales* values from **January 1** through **January 4**.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fz7NtC2ls6uGMEaLQnLwl%2Fimage.png?alt=media&amp;token=7559f4fb-ae08-4468-9d50-ee5837917e34" alt=""><figcaption></figcaption></figure>

### TOTALQTD

The **TOTALQTD** function evaluates the quarter-to-date value of a measure in the current context. It is typically used with an aggregate function such as `SUM` or `AVERAGE` to calculate cumulative values from the beginning of the current quarter up to the current period.

#### Syntax

```
TOTALQTD(measure)
```

#### Arguments

The **TOTALQTD** function syntax has the following arguments:

* `measure`: The measure for which the quarter-to-date value is calculated.

#### Return value

Returns the quarter-to-date range for the specified measure. When used with an aggregate function, it returns the cumulative value from the beginning of the current quarter up to the current period.

#### Example

```
SUM(TOTALQTD([Sales]))
```

Returns the cumulative sales value for each period within the current quarter.

In the following example, the **QTD** column displays the cumulative sales from the beginning of the current quarter up to each month. For example, the value for **February** is the sum of **January** and **February** sales, and the value for **March** is the sum of **January**, **February**, and **March** sales. When a new quarter begins, the cumulative total resets and starts again from the first month of that quarter.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2FsvHM9cniIuAukUCPwEjp%2Fimage.png?alt=media&amp;token=64a92b8a-d95b-4e44-80fd-a80ef3b3d394" alt=""><figcaption></figcaption></figure>

### TOTALYTD

The *TOTALYTD* function evaluates the year-to-date value of a measure in the current context. It is typically used with an aggregate function such as `SUM` or `AVERAGE` to calculate cumulative values from the beginning of the current year up to the current period.

#### Syntax

```
TOTALYTD([measure])
```

#### Arguments

* `measure`: The measure for which the year-to-date value is calculated.

#### Return value

Returns a range of values. When used with an aggregate function, it returns a scalar value representing the cumulative value from the beginning of the current year to the current period.

#### Example

```
SUM(TOTALYTD([Sales]))
```

Returns the year-to-date sales by cumulatively summing the *Sales* measure for each year.

In the following example, the *YTD* measure shows the cumulative sales from the beginning of each year up to the current period. The cumulative value resets at the start of a new year.

<figure><img src="https://257222532-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUtolck8kt8atqxFPsEBn%2Fuploads%2Fkbw7q5zOmVvuaI71bDnO%2Fimage.png?alt=media&amp;token=e6f017cf-9b19-4ee8-89d1-c5247879940e" alt=""><figcaption></figcaption></figure>


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fabricplan.com/planning-sheets/reference/formula-syntax/time-intelligence-functions/period-to-date-calculations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
