Unknown or inaccessible field when following PoP tutorial

Hello. I’m following this tutorial https://blog.montrealanalytics.com/the-ultimate-guide-to-period-over-period-analysis-in-looker-f19358397f19 but I’m getting stuck with some errors I can’t get rid of.

Looking at the step 2 I have the following LookML errors:

Unknown or inaccessible field “daily_pages.created_month_num” referenced in “daily_pages.created_month_of_quarter_advanced”. Check for typos or append a timeframe to the name if the field is type “time”.

this is the code of the first dimension of step two:

  dimension: created_month_of_quarter_advanced {
    label: "Orders Month of Quarter"
    group_label: "Orders Dates"
    group_item_label: "Month of Quarter"
    type: number
    sql:
      case
        when ${daily_pages.created_month_num} IN (1,4,7,10) THEN 1
        when ${daily_pages.created_month_num} IN (2,5,8,11) THEN 2
        else 3
      end
    ;;
  }

and this is how I’ve defined my daily_pages view :

view: daily_pages {
  sql_table_name: `my_source_table_here*`
    ;;

  dimension: date {
    primary_key: yes
    type: date
    datatype: yyyymmdd
    convert_tz: no
    description: "daily"
    sql: ${TABLE}.date ;;
  }

  dimension_group: date_grp {
    type: time
    description: "date"
    group_label: "daily date"
    timeframes: [
      raw,
      date,
      week,
      month,
      quarter,
      year
    ]
    convert_tz: no
    datatype: date
    sql: ${TABLE}.date ;;
  }

  dimension: visitNumber {
    primary_key: yes
    type: number
    description: "number of visits"
    sql: ${TABLE}.visitNumber ;;
  }

  measure: sum_visitNumber {
    type: sum
    sql: ${visitNumber} ;;
  }
}

What does the error mean exactly? Why do I’m missing?

The code in the tutorial is a refinement, which means it adds fields on top of the existing view. You have to make sure that your “order_items” view has a dimension_group called “created” and in the timeframes you have “month_num”

1 Like