Question

Case when for custom dimension (bucketing)

  • 13 August 2021
  • 0 replies
  • 242 views

Hello, I am hoping someone can give advice. I am looking to bucket orders.

My goal is to create two custom dimensions

  1. Total orders that CONTAIN shoes AND socks
  2. Overall total shoe orders regardless of other others (with or without other order names).

For example, order names may include

  1. shoes
  2. socks
  3. pants
  4. shirts
  5. jackets
  6. shorts

Does anyone know how to code this with a custom dimension on the front end? Versus creating a dimension on the backend of LookML. I only need this information for one tile so I don’t want to add it on the backend unless I have to.

 

I tried doing a custom dimension… Orders with shoes

case (when ($ {order_name} = “Shoes”, “Shoes”), “No Shoes”)

 

Orders with socks

case (when ($ {order_name} = “Socks”, “Socks”), “No Socks”) 

 

Then I pivoted these dimensions to get a combination of shoes, no shoes, socks and no socks order to get quantity of order combinations. But this did not achieve the overall goal.

 

The goal is to...

  1. get a count of order line items that contain shoes AND socks
  2. get a count of all orders that contain shoes

 


This topic has been closed for comments