This article can help you troubleshoot the "column must appear in the GROUP BY clause or be used in an aggregate function" error in Looker.
This error commonly occurs when a dimension is used in a measure that does not have an aggregate type. Our measure type documentation contains a list of measure types and whether each is an aggregate type.
For example, a type: number
measure is not an aggregate measure, so this LookML would produce an error:
measure: bad_measure { type: number sql: ${measure} + ${dimension} ;; }
Typically you fix this problem by first turning the dimension into a measure, and then using that new measure in your calculations. For example:
measure: dimension_total { type: sum sql: ${dimension} ;; } measure: good_measure { type: number sql: ${measure} + ${dimension_total} ;; }