#community-help

Understanding group_by with Multiple Fields

TLDR Magnus asked about using group_by with multiple fields. Jason explained it with an example of product size and color.

Powered by Struct AI
3
16mo
Solved
Join the chat
Jun 29, 2022 (16 months ago)
Magnus
Photo of md5-7d2796ababc14477f4c09abc2e8edb05
Magnus
06:51 PM
A related question. How does group_by work with multiple fields? I cannot wrap my head around how that works, and I cannot seem to find a good example.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
06:52 PM
If you do group_by=size,color for eg, products having each permutation of color and size will be placed in separate groups
06:53
Jason
06:53 PM
So for eg, the groups would be

small-blue, medium-blue, large-blue
small-brown, medium-brown, large-brown
small-black, medium-black, large-black

etc