Error: Field references an aggregate but is specified as a "dimension"

(hilary) #1

This error occurs when you try to reference a measure in the sql block of a dimension. Like so:

measure: count {
   type: count

dimension: count_over_2 {
  type: number
  sql: ${count}/2;;

You can fix the error by changing the second field here to a measure of type: number.

(romain.ducarrouge) #2

This error may also happen if you are using measures in a sql_always_where instead of in a sql_always_having!