Creating a new dimension (buckets) from previous variable.

Hello,

I am hoping someone can help me with this. I am not sure if this can be done in a table calculation or creating a new variable. I had originally tried to do this in LookML. And it did not work.

I would like to group together some retail stores, for example…

I would like to categorize or group JC Penny, Johns shoe shop, Target and Costco as “Channel_Bucket.”

896fd63b-3ecc-4835-8b5a-68ffc27d3c36.png

I had originally tried to do this in lookML using the case when function but it did not work for me unless I did it wrong.

For example,

dimension: channel_bucket {

  case: {

    when: {

      sql: ${TABLE}.channel = JC Penny, Johns shoe shop, Target, Costco ;;

      label: “Retail Other“

    }

    when: {

      sql: ${TABLE}.channel = Zappos, Backcountry ;;

      label: “Online”

    }

    when: {

      sql: ${TABLE}.channel = Soles, Dillards ;;

      label: “DT”

    }

    when: {

      sql: ${TABLE}.channel = Walmart ;;

label: “Walmart”

  }

    when: {

      sql: ${TABLE}.channel = Amazon;;

     label: “Amazon”

    }

  }

}

0 2 385
2 REPLIES 2

Try changing this: 

${TABLE}.channel = JC Penny, Johns shoe shop, Target, Costco

to

${TABLE}.channel IN("JC Penny", "Johns shoe shop", "Target", "Costco")

Thank you! That definitely worked!

Top Labels in this Space
Top Solution Authors