Question

How can I label my column string values differently in Looker?

  • 24 June 2021
  • 0 replies
  • 842 views

I have a column with few name values which are string basically and I need to just rename them so that it shows differently in the dashboard which I am preparing using LookML. The scenario is as follows--

 

This is what I have( the names are as follows- Jon, Smit, mary, beth):

 dimension: names {
    type: string
    sql: ${TABLE}.names ;;
  }

 

This is what I tried:

 

 dimension: names{
  type: string
  case: {
      when: {
        sql: ${TABLE}.name = 'Jon' ;;
        label: "John"
      }
    when: {
        sql: ${TABLE}.name = 'Smit' ;;
        label: "Smith"
      }
    when: {
        sql: ${TABLE}.name = 'mary' ;;
        label: "Mary"
      }
  when: {
        sql: ${TABLE}.name = 'beth' ;;
        label: "Beth"
      }

 

but it seems like it did not work as I am using this field as a filter in a dashboard and it is breaking everything. Can anyone suggest what I might be doing wrong here?


This topic has been closed for comments