View the original community article here
Last tested: Jul 4, 2018
The difference is that ${foo}
refers to the value in the field, whereas foo
refers to the field itself. So when performing math or string operations, we'd use ${}
like so:
dimension: do_math {
type: number
sql: ${foo} - ${bar} ;;
}
because we want the values of foo
and bar
to be pulled in and operated on. We do not use ${}
when we are referencing the field itself, for example in drill_fields
or order_by_field
where we are not describing the relationship between the values, but just a relationship between the fields. So we do:
measure: sum_something {
type: sum
sql: ${something} ;;
# use ${} since we want the values to be summed
drill_fields: [foo, bar, baz]
# no ${} since we don't care about the
# values, only that these are the fields to use
}
This content is subject to limited support.