/    /  Amazon QuickSight – Extract

Amazon QuickSight – Extract

 

The extract function in Amazon QuickSight is used to extract a specific component or part of a date value. The function takes two arguments: a required period parameter specifying the component you want to extract, and a required date parameter specifying the date value from which you want to extract the component.

Syntax

#Start#
extract(period, date)
#End#

 

This function takes three arguments

 

  • Period:  parameter specifies the component that you want to extract from the date parameter. The period parameter can take one of the following values

 

  • YEAR: Returns the year component of the date.
  • QUARTER: Returns the quarter of the year that the date falls into.
  • MONTH: Returns the month component of the date.
  • WEEK: Returns the week number of the year that the date falls into.
  • DAY: Returns the day component of the date.
  • HOUR: Returns the hour component of the date.
  • MINUTE: Returns the minute component of the date.
  • SECOND: Returns the second component of the date.
  • MILLISECOND: Returns the millisecond component of the date.

 

 

  • date: parameter specifies the date value from which you want to extract the component. The date parameter can be a date field from your data source or an expression that returns a date value.

 

 

For example, if you have a data set that includes a column for order dates and you want to create a new column that shows the month component of each order date, you can use the extract function to perform the extraction.

Example

#Start#
extract(MONTH, OrderDate)
#End#

 

This expression would extract the month component from the OrderDate field and return the result in the new column. The result would be a numeric value between 1 and 12, indicating the month of the order date.