<!-- https://learnsql.cpetoday.com/functions/dax/quarter -->
# QUARTER

Language: DAX
Category: Date and time
Syntax: QUARTER(<date>)
Summary: Returns the calendar quarter of a date, from 1 for January to March to 4 for October to December.
Returns: A whole number from 1 to 4.
Level: Beginner
Related: MONTH, YEAR, DATESQTD, TOTALQTD, STARTOFQUARTER

## What it does
QUARTER reads the calendar quarter out of a date. It is the base for quarter labels, quarter totals and quarter-end reviews. Companies with a fiscal year that does not start in January need a fiscal quarter, which QUARTER does not give directly, so it is often combined with a fiscal month number.

## Syntax and arguments
- date: any date or datetime value. Required.

## Example
A company has a June 30 year end. Its fiscal quarters are July to September (Q1), October to December (Q2), January to March (Q3) and April to June (Q4). The controller wants a fiscal quarter label in the Calendar table.

```dax
Fiscal Quarter =
"Q" & (MOD(QUARTER('Calendar'[Date]) - 3, 4) + 1)
```

A date in August gets Q1, because August is in calendar Q3 and the formula moves that to fiscal Q1. A date in February gets Q3. The formula moves the calendar quarter back so that the fiscal year starts in calendar Q3, which is when July begins.

## Example: a second, different use
A quarter label for a quarter-end report, such as Q4 2026, built from the year and quarter.

```dax
Quarter Label = "Q" & QUARTER('Calendar'[Date]) & " " & YEAR('Calendar'[Date])
```

## Things to watch
- QUARTER uses calendar quarters. A fiscal quarter needs the offset shown above, or a Calendar column built once.
- A quarter label such as Q1 repeats every year. Include the year in the label for a unique key.
- Sort quarter labels by a numeric key, such as year times 10 plus quarter, or the order will be wrong.
- For quarter-to-date totals, use TOTALQTD or DATESQTD with a date table. Those functions use the same quarter rules, so the two sets of numbers agree.

## In business terms
QUARTER drives quarter-end close, quarterly board packs, quarterly tax and estimated payment schedules, and the quarterly budget against actual review. Quarter labels that match the fiscal calendar are essential when the team reports to a lender or a parent company.
