blob: f25aefb2da91f6e317015b9a7019535d4cc6d2af [file] [log] [blame] [edit]
view: max_date {
derived_table: {
sql: SELECT max_partition_date AS max_date_minus_2
FROM `concord-test.stagingservice_gcc.gcc_revenue_latest_partition_view`
GROUP BY 1;;
}
########## PRIMARY KEYS ############
dimension: pk {
description: "Primary key. This table should only ever have one row, so any dimension should be the primary key."
hidden: yes
primary_key: yes
sql: ${max_date_minus_2_raw} ;;
}
########## DIMENSIONS ############
dimension_group: max_date_minus_2 {
description: "Calculates the latest date in the Revenue table and subtracts 2 days"
hidden: yes
type: time
datatype: date
timeframes: [raw, date, day_of_month, day_of_year, month, month_name, week]
sql: CAST(${TABLE}.max_date_minus_2 AS DATE) ;;
convert_tz: no
}
dimension: max_date_minus_2_day_of_quarter {
hidden: yes
description: "Day of quarter"
type: number
sql: DATE_DIFF(${max_date_minus_2_raw}, DATE_TRUNC(${max_date_minus_2_raw}, QUARTER), DAY) ;;
}
}