Custom dimension based on value from another dimension

Hi All,
Im trying to create a new dimension. Something like this but it does not work:

dimension: dim1{
     type: number
    sql: ${TABLE}.dim1 ;;
dimension: dim2{
     type: number
    sql: ${TABLE}.dim2 ;;

dimension: dim3 {
    case: {
      when: {
        sql:${TABLE}.dim2 <>72};;
        label: null
      else: ${TABLE}.dim1

Any ideas how to create a dimension that “filters” or gives a value based on another dimension?

1 Like

That general idea is on point! Looker case: syntax only allows you to use actual label values, not references to other fields. If you want to do that, you’ll have to write an actual SQL case when in the sql: parameter of the dimension.

Check out this neat article on when to use which type of case statement: Using lookml CASE vs sql CASE WHEN
Per @Jiro in that piece: