Skip to main content

Fields - Time

Time

Time is used to get group of time-based dimensions (like Year, Month, Day, Hour etc) from single column of time data.

Time can reference dimensions.

fields:   #begin of fields section (inside View or Model)
- time: time_name #for group of generated time-based dimensions
hidden: false
group_label: 'group label in UI'
group_description: 'group description in UI'
source: time_source
sql: 'SQL expression'
unnest: 'BigQuery UNNEST SQL expression'
timeframes:
- year
- quarter
- quarter_of_year
- month
- month_name
- month_num
- week
- week_of_year
- date
- day_of_week
- day_of_week_index
- day_of_month
- day_of_year
- hour
- hour2
- hour3
- hour4
- hour6
- hour8
- hour12
- hour_of_day
- minute
- minute2
- minute3
- minute5
- minute10
- minute15
- minute30
- time
- time_of_day
- yesno_has_value

Time Parameters

NameTypeDefaultDescription
time*string-Create a group of time dimensions based on column with time data
hiddenbooleanfalseHide field in UI
group_labelstring-Group label
group_descriptionstring-Group description
sourceenumtimestampProvide type of data that will be gathered using sql parameter:
  • timestamp - works for fields that contain date, datetime and timestamp data in bigquery
  • epoch - integer representing the number of seconds from the Unix epoch
  • yyyymmdd - string that contains date of the form YYYYMMDD
sql*string-Way to calculate field through SQL expression (can use BlockML references to other dimensions)
unneststring-(BigQuery) for example "JOIN UNNEST(payload.pages) AS page"
timeframesstring[]-Define a set of time dimensions you want to produce

Timeframes

NameOutput (2016-01-19 08:47:34 UTC)Result (implicitly set)
year2016ts
quarter2016-01ts
quarter_of_yearQ1quarter_of_year
month2016-01ts
month_nameJanuarymonth_name
month_num1number
week2016-01-18ts
week_of_year4number
date2016-01-19ts
day_of_weekTuesdayday_of_week
day_of_week_index2 (if week starts on Monday)day_of_week_index
day_of_month19number
day_of_year19number
hour2016-01-19 08ts
hour22016-01-19 08ts
hour32016-01-19 06ts
hour42016-01-19 08ts
hour62016-01-19 06ts
hour82016-01-19 08ts
hour122016-01-19 00ts
hour_of_day8number
minute2016-01-19 08:47ts
minute22016-01-19 08:46ts
minute32016-01-19 08:45ts
minute52016-01-19 08:45ts
minute102016-01-19 08:40ts
minute152016-01-19 08:45ts
minute302016-01-19 08:30ts
time2016-01-19 08:47:34ts
time_of_day08:47string
yesno_has_valueReturns Yes if SQL expression (after evaluation) has a value, otherwise Noyesno