How to change verticle dimension and aggregate

jjfox
New Member
Fruit apple
veggies carrot
Veggies broccoli
meat chicken
Fruit cherry

Hey everyone-- newer to Looker and wanted to see what was available. I have a dimension for products that are vertical and I aggregated into their buckets(  Fruit= apple, cherry) Is this possible to do on the front end of Looker?

0 2 152
2 REPLIES 2

Yes you can do with the help of pivoting the dimension. if you click on dimension you will see "pivot data ".

If I understand correctly you are looking for the ability to create the 'Bucket' dimension in Looker for grouping the products you have in the database table.

For this you will have to write case statement like below.

dimension: bucket {
type: string
sql: CASE WHEN ${TABLE}.product in( 'apple', 'cherry') THEN 'Fruit'
WHEN ${TABLE}.product in ('carrot', 'broccoli') THEN 'Veggies'
ELSE 'Meat' END ;;
}

 

Hope this helps !

~Ashish