-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalendar.view.lkml
67 lines (67 loc) · 1.53 KB
/
calendar.view.lkml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# include: "datagroups.view.lkml"
# view: calendar {
# derived_table: {
# datagroup_trigger: calendar
# sql: WITH
#test
#
# splitted AS (
# SELECT
# *
# FROM
# UNNEST( SPLIT(RPAD('',
# 1 + DATE_DIFF(CURRENT_DATE(), DATE("2010-01-01"), DAY),
# '.'),''))),
# with_row_numbers AS (
# SELECT
# ROW_NUMBER() OVER() AS pos,
# *
# FROM
# splitted),
# calendar_day AS (
# SELECT
# DATE_ADD(DATE("2010-01-01"), INTERVAL (pos - 1) DAY) AS day
# FROM
# with_row_numbers)
# SELECT
# *
# FROM
# calendar_day
# ORDER BY
# day DESC
# ;;
# }
# # Code from https://stackoverflow.com/questions/38694040/how-to-generate-date-series-to-occupy-absent-dates-in-google-biqquery
#
# dimension: pkey {
# hidden: yes
# primary_key: yes
# sql: ${date_raw} ;;
# }
#
# dimension_group: date {
# view_label: "Mint Data"
# label: "Calendar Table"
# type: time
# timeframes: [
# raw,
# date,
# week,
# month,
# quarter,
# year
# ]
# datatype: date
# sql: ${TABLE}.day ;;
# convert_tz: no
# }
#
# # measure: count_of_days {
# # # hidden: yes
# # type: count
# # }
#
# set: detail {
# fields: [date_date]
# }
# }