cubes:
    - name: events
      sql: "SELECT * FROM events"
      dimensions:
          - name: id
            type: number
            sql: id
          - name: created_at
            type: time
            sql: created_at
          # A granularity reference compiles into an embedded
          # TimeDimension symbol inside this dimension's tree.
          - name: created_day
            type: time
            sql: "{CUBE.created_at.day}"
          # A measure reached through a dimension's expression tree.
          - name: count_label
            type: string
            sql: "CASE WHEN {CUBE.count} > 3 THEN 'high' ELSE 'low' END"
      measures:
          - name: count
            type: count
