Measure Returns NULL When it Shouldn't

PaulM1
New Member

Using Snowflake connection.

Given the following dimension_group and measure:

  dimension_group: Started {
    label: "Start"
    type: time
    convert_tz: no
    sql: ${TABLE}."DATETIME_STARTED" ;;
    timeframes: [
      raw,
      date,
      day_of_week,
      hour8,
      month,
      month_name,
      month_num,
      quarter,
      quarter_of_year,
      time,
      time_of_day,
      week,
      year
    ]
  }

  measure: m_Started_min {
    label: "Start Date - First"
    type: min
    sql: ${Started_date};;
  }

The measure returns NULL, even though there are no NULLs in the DB table column. If I open the resulting query in SQL Runner, or copy/paste the SQL into a Snowflake query editor, the correct value is returned.

In addition, modifying the measure to the following does indeed return a correct value in Looker:

  measure: m_Started_min {
    label: "Start Date - First"
    type: time
    convert_tz: no
    sql: MIN(${TABLE}."DATETIME_STARTED") ;;
    timeframes: [
      time
    ]
  }

And ideas on why this there are inconsistent results?

0 1 421
1 REPLY 1

That’s because type: min and type: max do not work with anything else than numbers.

More detailed explanation here: https://help.looker.com/hc/en-us/articles/360023425454-Max-or-Min-Date-Measure

Top Labels in this Space
Top Solution Authors