Grouping dimensions using 'case when' grouping users lookml code.


Please help. For context, 1 user can have multiple generations of a product. 


Generation 1
Generation 2
Generation 3

I want to isolate users by grouping these generational products into

Example: Generation 1 only users
Example: Generation 2 only users
Example: Generation 3 only users
Example: Generation 1 AND Generation 2 users


I also want to look at users who have Generation 1 and Generation 2.


My first idea was to isolate only users who have had a Generation 1 item exclusively meaning they haven't any other products from the line.

I cannot seem to get anything to run properly. 


LookML start to my code. I first tried to isolate Generation 1 only users then building the query or code from there.

dimension: customer_type {
  case: {
  when: {sql: ${TABLE}.product_family IN "Generation 1"} 
  AND ${TABLE}.product_family NOT IN ("Generation 2")
  OR ${TABLE}.product_family NOT IN ("Generation 3");;
  label: "Generation 1 only users"
  }
  else: "Other"
}
}


#Isolate Generation 1 only users, and not users that contain multiple items

#Figure out users that contain both Generation 1 AND 2 

0 REPLIES 0
Top Labels in this Space
Top Solution Authors