extract(period, date) returns one part of a date as an integer: the year, the quarter, the month, the day, the weekday or a time part. Names, such as “May” or “Thursday”, come from formatDate instead.

Copy and paste

extract('YYYY', {Order Date})   /* year: 2026 */
extract('Q', {Order Date})      /* quarter: 1 to 4 */
extract('MM', {Order Date})     /* month: 1 to 12 */
extract('DD', {Order Date})     /* day of the month: 1 to 31 */
extract('WD', {Order Date})     /* weekday: 1 = Sunday ... 7 = Saturday */
extract('HH', {Order Date})     /* hour: 0 to 23 */

Year and month as one number, 202605:

extract('YYYY', {Order Date}) * 100 + extract('MM', {Order Date})

Month and day names:

formatDate({Order Date}, 'MMMM')   /* May */
formatDate({Order Date}, 'EEEE')   /* Thursday */

Example

For an order on Thursday 14 May 2026 at 14:30:

Period Result
'YYYY' 2026
'Q' 2
'MM' 5
'DD' 14
'WD' 5
'HH' 14
'MI' 30

'WD' counts from Sunday, so Thursday is 5, not 4. On a date without a time, the time parts return 0.

The month alone loses the year

extract('MM', ...) puts May 2025 and May 2026 in the same group. That is what you want for seasonality (“which month sells best?”) and wrong for a time series. For a monthly trend, use truncDate('MM', {Order Date}) or the Month aggregation of the date field, which keep the year.

Integers that look like measures

The results are integers, so QuickSight may treat them as measures, sum them when you drop them in a field well and show the year with a thousands separator, as 2,026. Drag the field to a dimension well (or change it to a dimension in the field list), and set the number format to remove the separator.

Names sort alphabetically

formatDate returns text. A visual sorted by month name puts April before January. Sort by extract('MM', ...), or keep a date field on the axis and change its display format instead of turning it into text. More in how to format a date as text.

Checked against the Amazon Quick Sight function reference (October 2026). The example results were recomputed in DuckDB.

References