Convert dimension of type string to number

Want to convert dimension of type string to number

1 2 1,856
2 REPLIES 2

Dawid
Participant V

Great! Where did you happen to find a problem/error?

lindenPMP
Participant II

So, for example, starting with your existing dimension with type of string

dimension: string_dim {
type: string
sql: ${TABLE}.string_field;;
}

 You should be able to convert the existing dimension by casting it to a number:

dimension: string_to_num_dim {
type: number
sql: CAST(${TABLE}.string_field as INTEGER);;
}